Liquid, JavaScript, themes, sales channels
Join us March 21 for an AMA on planning your 2023 marketing budget with 2H Media co-owners, Matt and Aron
I would like a standard message to appear when a customer selects a product (including product variant) that has no stock. I am allowing products to continue to be sold when they are out of stock, but would like to display the standard message to let the customer know that delivery will take longer (because it is made-to-order).
Hi @KWJ,
Go to sections > main-product.liquid file, find 'product-form__error-message' and add code here:
Code:
{%- if product.selected_or_first_available_variant.inventory_quantity <= 0 and product.selected_or_first_available_variant.inventory_management == 'shopify' -%}
<!-- show message -->
{%- endif -%}
Hope it helps!
Hi @LitExtension - thanks so much for taking the time to reply. Is there a way of making this work when a different variant is selected? Using the code you provided, the first variant when I visit the product page shows the message (because stock is zero but variant is set to 'keep on selling'). But if I choose another variant which is in stock, the message still displays.
User | RANK |
---|---|
21 | |
20 | |
13 | |
12 | |
8 |
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023