Skip to main content

Show or hide content based on specific values

Anything captured by the script is available to use in the cart layout, and the values can be called upon to display or hide content.

Updated over a week ago

Examples:

  1. Display prices if the product is in a specific category:

{% for product in products if product|is_in_categories(['example1', 'example2']) %} {# this will only show products in either the example1 or example2 categories #} {% endfor %}

2. You want to hide a product price where it was over a specific value:
​

{% for product in products if product.uv < 100 %} {# this will only show products where the unit value (uv) is below 100 #} {% endfor %}

Did this answer your question?