Getting Started

Prevent hidden line item properties showing in your theme (_Gifted)

Updated 4 days ago

The Shopify platform allows you to attach information to line items in your cart using line item properties. EG makes use of these to track which items the app has added to the cart.

Line item properties which begin with an underscore "_" are classified as hidden properties, and Shopify will not show them on the /checkout page or on invoices.

Most themes also respect this and hide them from the online store, but this is not supported by every theme. To fix this, all we need to do is add a condition to the line item property loop in your cart.liquid template (it could also be in another file - see Notes for more file name examples).

Within your cart.liquid (or other cart file, examples listed in Notes below) template, find this line:

{% for p in item.properties %}

Note: this line may be different in your theme, it could be {% for prop in [item.properties](http://item.properties) %}

Paste this directly beneath it:

{% if p.first.first == "_" %}{% continue %}{% endif %}

đź’ˇNotes:

  • Some themes use different file names for the cart template. Instead of cart.liquid it could be called something like: cart-template.liquid, cart-drawer.liquid, cart-item.liquid, main-cart-items.liquid or mini-cart.liquid Top tip: if none of these filename examples are in your theme, you should search 'cart' or 'item' in your theme files to find the file(s) responsible for displaying the cart.

  • Some files will use a different variable name for the code. Instead of p, it could be property or prop. This is where you'd need to replace p with property in the code you copied from above.

‍

Having trouble getting this to work? Contact support

Previous

How to Create A Rule For EG

Next