Vouchers Controller - Liquid Controller Reference
On this page
Description
The Vouchers controller handles requests related to vouchers functionality in your StoreConnect storefront.
| Property | Value |
|---|---|
| Controller | VouchersController |
| Liquid Template Path | controllers/vouchers/ |
Actions
| Action | HTTP Method | Route | Liquid Page |
|---|---|---|---|
render_show_with |
GET | /vouchers/render-show-with |
voucher |
Liquid Controller Lifecycle
For each action, Liquid controller templates are executed in three phases:
- Before —
controllers/vouchers/{action}.liquidruns before the Rails action - After — runs after the Rails action but before the response is sent
- Final — runs after the response, useful for cleanup
Available Liquid Tags
Inside controller templates, these tags are available:
| Tag | Description |
|---|---|
{% params %} |
Set request parameters (e.g. {% params foo: "bar" %}) |
{% variables %} |
Set template variables (e.g. {% variables title: "Hello" %}) |
{% respond %} |
Respond with custom content, alert, or notice |
{% redirect %} |
Redirect the request (e.g. {% redirect to: "/products" %}) |
{% action %} |
Execute a server-side action (e.g. {% action "cart.add" %}) |
Example
Create a file at controllers/vouchers/render_show_with.liquid:
liquid
{% before %}
variables custom_heading: "Welcome"
{% endbefore %}