Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
in this product available quantity and on hand qty 2. so "sold out" label show correctly. but i need to disable sold out button.
{%- form 'product', product, id: form_id, class: 'product-single__form' -%} {%- if shop.taxes_included or shop.shipping_policy.body != blank -%} <div class="product__policies rte"> {%- if shop.taxes_included -%} {{ 'products.product.include_taxes' | t }} {%- endif -%} {%- if shop.shipping_policy.body != blank -%} {{ 'products.product.shipping_policy_html' | t: link: shop.shipping_policy.url }} {%- endif -%} </div> {%- endif -%} {%- liquid assign enable_dynamic_buttons = false if show_dynamic_checkout and template != 'product.preorder' assign enable_dynamic_buttons = true endif -%} {%- if enable_dynamic_buttons -%} <div class="payment-buttons"> {%- endif -%} {%- liquid assign default_text = 'products.product.add_to_cart' | t assign button_text = 'products.product.add_to_cart' | t if template == 'product.preorder' assign default_text = 'products.product.preorder' | t assign button_text = 'products.product.preorder' | t endif if current_variant.inventory_management == 'shopify' if product.variants.size > 1 if product.variants.first.inventory_quantity < 2 assign button_text = 'products.product.add_to_cart' | t endif else if current_variant.inventory_quantity <= 2 assign button_text = 'products.product.sold_out' | t endif endif endif -%} <button {% if product.empty? %}type="button"{% else %}type="submit"{% endif %} name="add" data-add-to-cart class="btn btn--full add-to-cart{% if enable_dynamic_buttons and product.selling_plan_groups == empty %} btn--secondary{% endif %}" {% if current_variant.inventory_management == 'shopify' %}{%- if product.variants.size > 1 -%}{% if product.variants.first.inventory_quantity >= 2 %} disabled="disabled"{% endif %}{% else %}{% if current_variant.inventory_quantity <= 2 %}disabled="disabled"{% endif %} {% endif %} {% endif %} > <span data-add-to-cart-text data-default-text="{{ default_text }}"> {{ button_text }} </span> </button> {%- if enable_dynamic_buttons -%} {{ form | payment_button }} {%- endif -%} {%- if enable_dynamic_buttons -%} </div> {%- endif -%} <div class="shopify-payment-terms product__policies">{{ form | payment_terms }}</div> <select name="id" data-product-select class="product-single__variants no-js"> {%- for variant in product.variants -%} {%- if variant.available -%} <option {% if variant == product.selected_or_first_available_variant %} selected="selected"{% endif %} value="{{ variant.id }}"> {{ variant.title }} - {{ variant.price | money_with_currency }} </option> {%- else -%} <option disabled="disabled"> {{ variant.title }} - {{ 'products.product.sold_out' | t }} </option> {%- endif -%} {%- endfor -%} </select> <textarea data-variant-json class="hide" aria-hidden="true" aria-label="Product JSON"> {{ product.variants | json }} </textarea> {%- if product.options.size > 1 -%} <textarea data-current-variant-json class="hide" aria-hidden="true" aria-label="Variant JSON"> {{ current_variant | json }} </textarea> {%- endif -%} {%- endform -%}
i need modify this code.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025