I am trying to create a global boolean variable and use it to check if a condition is met. If the condition is met perform a certain action and set to true so that the next time the action is not performed.
Here is the code I was trying to use, currently it looks like the global variable is not a affected and its always set to true and the action always takes place.
Thank you in advance! And any recommendations on how to dry this will be appreciated.
{% assign firstFound = false %}
{% if product.metafields.pdm.product-details %}
{% if firstFound == false %} {% assign firstFound = true %} {% endif %}
<li><button type="button" class="reset {% if firstFound == true %}active{% endif %}" data-target="details">Product Details</button></li>
{% endif %}
{% if settings.about_diamonds %}
{% if firstFound == false %} {% assign firstFound = true %} {% endif %}
<li><button type="button" class="reset {% if firstFound == true %}active{% endif %}" data-target="diamonds">About Our Diamonds</button></li>
{% endif %}
{% if settings.shipping_returns %}
{% if firstFound == false %} {% assign firstFound = true %} {% endif %}
<li><button type="button" class="reset {% if firstFound == true %}active{% endif %}" data-target="shipping">Shipping and Returns</button></li>
{% endif %}