Cashback Program Metaobject
The Cashback Program metaobject allows you to configure and manage cashback rewards for your customers. This documentation covers how to access and use the metaobject in your Shopify store.
Accessing the Metaobject
To access the Cashback Program metaobject in your Liquid templates, use the following code:
_10{%- assign cashback_program = shop.metaobjects.app--60169453569--cashback_program.v2 -%}
Available Fields
The Cashback Program metaobject contains the following fields:
Field Name | Type | Description |
---|---|---|
is_active | Boolean | Controls whether the cashback program is currently active |
cashback_percentage | Decimal | The percentage of purchase amount awarded as cashback |
credit_expiry_days | Integer | Number of days until the cashback credit expires |
credit_availability_delay_days | Integer | Number of days before cashback credit becomes available |
Field Details
Field Name | Type | Purpose | Usage |
---|---|---|---|
is_active | Boolean | Controls the overall activation state of the cashback program | Use this to conditionally enable or disable the entire cashback functionality |
cashback_percentage | Decimal | Defines the percentage of the purchase amount that will be awarded as cashback | (*) |
credit_expiry_days | Integer | Specifies how long the cashback credit remains valid after being issued | Use this to communicate to customers when their cashback store credit will expire |
credit_availability_delay_days | Integer | Determines how many days after a purchase the cashback credit becomes available | Helps manage the delay between purchase and cashback credit availability |
(*) Display as a percentage value ( e.g., {{ cashback_program.cashback_percentage }}%
)
Example Usage
Here's a complete example of how to display the Cashback Program settings in your Liquid template:
_27{%- comment -%} Cashback Program {%- endcomment -%}_27{%- assign cashback_program = shop.metaobjects.app--60169453569--cashback_program.v2 -%}_27{% if cashback_program %}_27<h2>Cashback Program</h2>_27<table class="program-table">_27 <tr>_27 <th>Setting</th>_27 <th>Value</th>_27 </tr>_27 <tr>_27 <td>Is Active</td>_27 <td>{{ cashback_program.is_active }}</td>_27 </tr>_27 <tr>_27 <td>Cashback Percentage</td>_27 <td>{{ cashback_program.cashback_percentage }}%</td>_27 </tr>_27 <tr>_27 <td>Credit Expiry Days</td>_27 <td>{{ cashback_program.credit_expiry_days }}</td>_27 </tr>_27 <tr>_27 <td>Credit Availability Delay Days</td>_27 <td>{{ cashback_program.credit_availability_delay_days }}</td>_27 </tr>_27</table>_27{% endif %}
Best Practices
- Always check if the metaobject exists before accessing its properties:
_10{% if cashback_program %}_10 // Your code here_10{% endif %}
- Format the cashback percentage appropriately:
_10{{ cashback_program.cashback_percentage }}%
-
Consider using the
credit_availability_delay_days
andcredit_expiry_days
values to create clear messaging about when cashback becomes available and expires. -
When displaying cashback amounts for specific purchases, calculate using the percentage:
_10{% assign cashback_amount = order.total_price | times: cashback_program.cashback_percentage | divided_by: 100 %}_10{{ cashback_amount | money }}