I am trying to disable sold out variants and grey out the button.
here is an example
https://www.nike.com/ca/t/air-jordan-1-low-shoes-v2kdOZ/553558-130
I am trying to disable sold out variants and grey out the button.
here is an example
https://www.nike.com/ca/t/air-jordan-1-low-shoes-v2kdOZ/553558-130
Welcome to the Shopify community!
Thanks for your good question.
Please share your store URL.
So that I will check and let you know the exact solution here.
Go to sections/main-product.liquid and add code: https://i.imgur.com/OBBQfm3.png
Code:
{%- assign variant_label_state = true -%}
{%- if product.options.size == 1 -%}
{%- unless product.variants[forloop.index0].available -%}
{%- assign variant_label_state = false -%}
{%- endunless -%}
{%- endif -%}
<input type=“radio” id=“{{ section.id }}-{{ option.name }}-{{ forloop.index0 }}”
name=“{{ option.name }}”
{% unless variant_label_state %} disabled=“disabled”{% endunless %}
value=“{{ value | escape }}”
form=“product-form-{{ section.id }}”
{% if option.selected_value == value %}checked{% endif %}
this fixed it
Doesn’t seem to work with Dawn 5.0?
the code works for Dawn 5.0 too, but the solution is a bit dirty since it works only for products with one variants option
Its only working with single variants products
I realize this is an old thread but in case anyone comes upon this, if you take the previous posted solution and remove the if statement, it will work in Dawn with a product that has multiple variants.
{%- assign variant_label_state = true -%}
{%- unless product.variants[forloop.index0].available -%}
{%- assign variant_label_state = false -%}
{%- endunless -%}
This is really helpful but I’m stupid and cannot for the life of me work out where to add this to Dawn 9.0. Can you help please?
off sitewide
July sale — 45% off at checkout, applied automatically. Valid for 60 minutes. One per customer.
Offer ends in