How to display the subscription frequency of ReCharge app on the cart page
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.
- From your Shopify admin, go to Online Store > Themes.
- Find the theme you want to edit, and then click Actions > Edit code.
- In the Templates directory, click cart.liquid to open.
- 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 code1234567891011121314151617181920{% 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:123{% if recurringchecked == "true" %}Recurring Delivery every {{frequency}} {{frequency_unit}}. Change or cancel anytime{% endif %} - Click Save and you are done.
ReCharge is a recurring billing app built exclusively for Shopify. It’s tailor-made for stores with physical subscription products for a seamless customer checkout. |