Skip to main content

Show or hide content based on specific values

Control which products or details appear in your cart layout by using values captured by Fresh Relevance.

Updated over a month ago

Values captured by the Fresh Relevance script can be used in your cart layouts to selectively show or hide product information. This allows you to customize the content of triggered messages based on category, price, or other attributes.

Example 1: Display prices for products in specific categories

Use this loop to show only products in example1 or example2 categories:

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

Example 2: Hide product prices over a specific value

Use this loop to show only products with a unit value (uv) below 100:

{% 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?