Hide subscription line item properties in cart
Does it happen that the subscription properties which start with underscore (_) are visible on your cart page?
Some themes might not automatically hide subscription properties which start with underscore.You can know this if you subscribe to an item, go to cart and see properties like _ssub_interval: 30 day or _ssub_ruleid: 424. You can either manually edit your cart Liquid file or you can contact us and we can edit the file for you. The instructions on how to edit the cart template file are below.
How do I hide subscription properties?
Step 1: Open you Shopify theme files (Online store -> Actions -> Edit code)
Step 2: Open your cart template liquid file
It is usually named cart-template.liquid and is located in Sections folder.
Step 3: Find the part of code where the line item properties are being displayed
Start scrolling down and find the properties loop usually starts with
{%- for p in properties -%}
. You can also
use the search function to find it faster.
You will probably also find this code a few lines below it
{% unless p.last == blank %}
Step 4: Add 1 condition
Now that you have found the properties loop, you have to change the condition where the code checks if the property is blank
{% unless p.last == blank %}
.
Modify it with these two lines of code:
{% assign first_character_in_key = p.first | truncate: 1, '' %}
{% unless p.last == blank or first_character_in_key == '_' %}
Here is a screenshot of how it looked in our template after we added the code.
Step 4: Save the template and check if subscription properties are now hidden on your cart page
And you are done :) If you need any help, you can always contact us at support@sealsubscriptions.com.