Shopify themes, liquid, logos, and UX
Hi,
I am using Dawn on a new 2.0 build. I am using ECompser Builder for my templates.
I am trying to display inventory in a collection grid. They have a nice "snippet" function where it will loop through, once you add the Liquid.
I found this code block:
{% comment %} Inventory tracking on product page {% endcomment %}
<div id="variant-inventory" class="{% unless current_variant.available %} hide {% endunless %}">
{% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != "continue" %}
We have {{ current_variant.inventory_quantity }} in stock.
{% else %}
Contact Us for lead time
{% endif %}
</div>
My products have inventory on hand, are set to track, set to sell if out of stock.
I want to show the live inventory before the Add to Cart button. If out of stock "Contact Us" message.
Right now, the code is only showing the out of stock message for everything, which isn't true.
Any thoughts on what to change to make it work? The code is from a post dated 2018. So, not sure what's changed, as I am new.
Thanks!
Pete
Hi @Uni-Trend
You can try to use this version of code. Make sure you setup correct inventory_management and inventory_policy
<div id="variant-inventory" class="{% unless card_product.selected_variant.available %} hide {% endunless %}">
{% if card_product.selected_variant.inventory_management == "shopify" and card_product.selected_variant.inventory_policy != "continue" %}
We have {{ card_product.selected_variant.inventory_quantity }} in stock.
{% else %}
Contact Us for lead time
{% endif %}
</div>
- Helpful? Like and Accept solution! or Buy me coffee
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Hi Dan,
Thanks. It is still just showing the Contact Us wording.
Doesn't != mean "not equal" to? I have my policies set as:
Variant Inventory Tracker | Variant Inventory Policy |
shopify | continue |
This is from my system export. So, should it be == "continue"? I want my products to allow to be purchased if there is no stock, I just want to make sure the customer knows this and they can contact us before purchasing, if they'd like, to confirm lead time.
Is the field "inventory_management" or "inventory_tracker"?
Also, my products don't have variants, there's only one of each model/SKU. Does that matter?
Thanks in advance for your help.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By 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, 2024