Do not display Item Variant when Variant has a certain name

rockandstars
New Member
1 0 0

Hey there,

 

I got this snippet in my cart.template.liquid:

 

 

{% unless item.variant.title contains 'Default' %}
             <p class="table-shopping-cart-item-variant">{{ item.variant.title | escape }}</p>
            {% endunless %}

 

 

What would i need to add to hide the {{ item.variant.title | escape }} when the variant contains 'sq'?

 

The background is: I use some variants that don't have a correct name but are used for a calculation. They have names like 1.00sq/2.00sq  etc. I don't want those to appear in the cart (and anywhere else, if possible).

Bildschirmfoto 2022-04-26 um 17.40.51.png

 

I am new to liquid code and therefore have no clue how to solve this.

Reply 1 (1)
LitExtension
Shopify Partner
3374 665 726

Hi @rockandstars,

Please change 'Default' => 'sq', it will work fine.

{% unless item.variant.title contains 'sq' %}
      <p class="table-shopping-cart-item-variant">{{ item.variant.title | escape }}</p>
{% endunless %}

Hope it helps!

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!