Hello,
I am using Supply theme and if there are some items (variants of items) in stock the message says "Only X items left!" (standard theme feature).
What I wanted to have is custom message when there is 0 items in stock.
For example:
There are 5 items (variants of items) in stock so message says:
"Only 5 items left!" (as it is now)
There is 0 items in stock so message would say:
"Item available from a supplier. Allow 2-3 weeks to deliver"
Here is a code for standard "only x items left" feature inserted.
{% if section.settings.product_quantity_message%} <div id="variantQuantity-{{ section.id }}" class="variant-quantity {% if variant.inventory_management and variant.inventory_quantity < 10 and variant.inventory_quantity > 0 %} is-visible{% endif %}"> {% include 'svg-definitions' with 'stock-icon' %} {% if variant.inventory_management and variant.inventory_quantity < 10 and variant.inventory_quantity > 0 %} {% assign qty = variant.inventory_quantity %} <span id="variantQuantity-{{ section.id }}__message">{{ 'products.product.only_left' | t: count: qty }}</span> {% endif %} </div>
Could please anyone help?
Thank you.
Regards
Solved! Go to the solution
Go into Online Store > Actions > Edit Code
Then navigate to your Locales folder and open your en.default.json. Scroll to around line 310 and locate the "product" object and change the "sold_out" text to whatever you want.
Hi @adios,
Welcome to the Shopify Community!
I understand that you want to have a custom message show when there is 0 items in stock.
I may be able to help you with this. I've updated your code to show the message, but please do verify that it works as intended.
Note: For the code to work, you must have these options checked for the 0 inventory products:
Try this code:
{% if section.settings.product_quantity_message or variant.inventory_management and variant.inventory_quantity <= 0 and variant.available %} <div id="variantQuantity-{{ section.id }}" class="variant-quantity is-visible"> {% include 'svg-definitions' with 'stock-icon' %} {% assign qty = variant.inventory_quantity %} {% if variant.inventory_management and variant.inventory_quantity < 10 and variant.inventory_quantity > 0 %} <span id="variantQuantity-{{ section.id }}__message">{{ 'products.product.only_left' | t: count: qty }}</span> {% elsif variant.inventory_management and variant.inventory_quantity <= 0 %} <span id="variantQuantity-{{ section.id }}__message">Item available from a supplier. Allow 2-3 weeks to deliver.</span> {% endif %} </div> {% endif %}
Let me know if this works or if you need further help!
Brian | Shopify Partner | Ecommerce Consultant
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Need further assistance? Visit www.BrianAtWork.com
Hi @BrianAtWork,
All the options are checked and code was pasted, but regrettably the message does not show up.
Here is the product with one of variants in stock and others out of stock.
Thank you for the support.
Regards
Hi @adios,
That is odd – the code is working for my test store.
Your products may be set up differently.
Your store would need to be accessed and your products analyzed, in order to make the appropriate changes to the code.
If you're interested in working together, please send me a private message or email. I'm sure @Ninthony would be willing to help you too. You may also hire help from the Shopify Experts Marketplace.
Cheers!
Brian | Shopify Partner | Ecommerce Consultant
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Need further assistance? Visit www.BrianAtWork.com
@adios Sounds like an app or a theme script is overriding the product description after page load. This could also be due to the placement of your code. Depends on your theme and the apps you have installed.
Brian | Shopify Partner | Ecommerce Consultant
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Need further assistance? Visit www.BrianAtWork.com
I'd be happy to help. For my solution, I was under the impression that you wouldn't need the add to cart button and that they were being informed that they could purchase it from the supplier directly. You can shoot me a message on here and if you want to let me know exactly what it is you need to do I can get back to you.
Hello @Ninthony,
I would need that customers could use "add to cart" button, but before they add product to a basket they would be advised that the lead time is 2-3 weeks for the particular item (item variant).
As you could see above there is an information with button but unfortunately the info disappears.
Can you provide a link to your store? It's got to be some kind of javascript that's hiding it which would need to be tracked down.
User | Count |
---|---|
709 | |
142 | |
103 | |
64 | |
36 |