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.
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024