Hiding Custom Product Properties on the Cart Page [OCU]

Find out how to prevent OCU Pre-Purchase product properties from showing on the cart page!

Jeff Maxfield avatar
Written by Jeff Maxfield
Updated over a week ago

Depending on the Theme being used, if a customer adds an OCU Pre-Purchase offer(s) to their cart, then they may visually see custom product properties added to those product(s) there. This can potentially be confusing to customers and visually unappealing for merchants.

To prevent these custom product properties from appearing, follow the information and steps below and/or see this video:


1. Navigate to your Theme files by going to Online Store > Themes > Actions > Edit code in your Shopify admin.

2. Find the file that contains information about the Cart Page. Usually it’s called templates/cart.liquid or sections/cart-template.liquid. Sometimes it can be called cart.json, main-cart.liquid, framework--cart.liquid or any other way depending on your Theme.


This file will have a section of code that looks something like this:

{% for p in item.properties %}
{% unless p.last == blank%}
{{ p.first }}: {{ p.last }}
{% endunless %}
{% endfor %}

To quickly find this section of code in the file, press Ctrl+F after clicking into the file and search for {% for p in item.properties %}

3. After the {% for p in item.properties %} line, add {% if p.first.first == "_" %}{% continue %}{% endif %} by copying from this article and pasting the code.

It should end up looking close to this:

{% for p in item.properties %}
{% if p.first.first == "_" %}{% continue %}{% endif %}
{% unless p.last == blank %}
{{ p.first }}: {{ p.last }}
{% endunless %}
{% endfor %}

*Note: If you have {% for property in item.properties %} instead of {% for p in
item.properties %}

Then use {% if property.first.first == "_" %}{% continue %}{% endif
%}
instead.

4. Save the file.

Adding this code prevents custom product properties that start with an "_" character from showing on the Cart Page:

Did this answer your question?