Liquid, JavaScript, themes, sales channels
Hy guys. I hope you can help me . Product sizes grid look like this. If size variant sold out - name + Sold out status.
I was able to implement in this way -
<select class="single-option-selector single-option-selector-{{ section.id }} product-form__input notranslate"
id="SingleOptionSelector-{{ forloop.index0 }}"
data-name="{{ option.name }}"
data-index="option{{ forloop.index }}">
{% for value in option.values %}
{% if product.options_with_values.size == 1 %}
{% assign show_sold_out = 1 %}
{% else %}
{% assign show_sold_out = 0 %}
{% endif %}
{% assign sold_out = false %}
{% if show_sold_out %}
{% for variant in product.variants %}
{% if variant.option1 == value %}
{% unless variant.available %}
{% assign sold_out = true %}
{% endunless %}
{% endif %}
{% endfor %}
{% endif %}
<option {% if option.selected_value == value %}selected{% endif %} value="{{ value }}">
{{ value }}{% if sold_out %} - {{ 'products.product.sold_out' | t }}{% endif %}
</option>
{% endfor %}
</select>
But, if product have two sized grid , sold out status work only in first size options.
What i am need change in code to make it work with two sized grid? Do not show sold out status in the first and show sold out status in the second sized grid.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024