Displaying the subscription frequency on the cart page
Recharge Checkout on Shopify
You may want to display the subscription frequency below each product on the cart page. This guide provides the code to add to your cart.liquid
file to show the frequency.
Platform: Recharge Checkout on Shopify
Before you start
- This feature requires advanced HTML and Shopify Liquid knowledge.
- This customization is not supported by Recharge as per our design and integration policy since it requires custom coding. If you are not working with a developer currently, Recharge recommends hiring a Recharge Agency Partner.
View an example
Install the code
- In your Shopify Admin, click Online Store and select Themes.
- Locate your theme, click Actions, and select Edit code.
- Open the cart.liquid file and search for the section of code that runs the properties of each product in the cart. It will generally look like this:
- Between the
{% endunless %}
and{% endfor %}
, add the following lines of code:{% assign recurringchecked = "false" %} {% for p in item.properties %} {% if p.first == 'shipping_interval_frequency' %} {% assign frequency = p.last %} {% assign recurringchecked = "true" %} {% endif %} {% if p.first == 'shipping_interval_unit_type' %} {% if frequency == '1'%} {% if p.last == 'Days' %} {% assign frequency_unit = 'Day' %} {% elsif p.last == 'Months'%} {% assign frequency_unit = 'Month' %} {% elsif p.last == 'Weeks'%} {% assign frequency_unit = 'Week' %} {% endif %} {% else %} {% assign frequency_unit = p.last %} {% endif %} {% endif %} {% endfor %}
- Add the following code above the last
{% endif %}
to show the text:{% if recurringchecked == "true" %} Recurring Delivery every {{frequency}} {{frequency_unit}}. Change or cancel anytime
{% endif %} - Click Save.
Was this article helpful?
1 out of 1 found this helpful