type:
snippet
category:
receipt
name:
Display Conditional Content
description:
Display conditional content based on any type of criteria.
versions:
2.0

Display Conditional Content

Using the sample code below, you can display custom html, javascript, etc. based on any criteria. For example, set parameter as false if specific product category is found:

{% if context == 'receipt' %}

    {% set candy = true %}

    {% for item in items %}
        {% if item.category == 'WHOLESALE' %}
            {% set categoryFound = false %}
        {% endif %}
    {% endfor %}

    {% if categoryFound %}
<h1>Success!</h1>
    {% endif %}

{% endif %}{# context == receipt #}

Site Tools