twig if else 1

twig if else

// twig if else
{% if process_1 %}
   {{ process_1 }}
{% elseif process_2 %}
   Only {{ process_2 }} left!
{% else %}
   Sold-out!
{% endif %}

Here is what the above code is Doing:
1. If process_1 is true, then print process_1.
2. If process_1 is false, but process_2 is true, then print Only process_2 left!.
3. If both process_1 and process_2 are false, then print Sold-out!.

Similar Posts