Using Inventory Status on Dawn 15, I have put the threshold at 4 but it is still showing the number of pieces in stock over that amount.
I want it to show 1, 2, 3, or 4 items if 4 or less and show nothing if the count is 5 or over. This doesn’t seem to be an option, which surprises me. Might there be a way around it?
Hi @Smeelah , if you know how to code, that’s a code thing. Not possible from theme customization, I can assist you with this, it has to be done with the product inventory section. DM
Thank you, @shahrozbabar5 , I’d be happy to adjust the code if you can suggest anything. I am looking at main-product.liquid but I am not sure how to adjust it.
{%- when 'inventory_count' -%}
{% if product.selected_or_first_available_variant.inventory_quantity <= block.settings.show_inventory_threshold or block.settings.show_inventory_threshold == 0 %}
Only **{{ product.selected_or_first_available_variant.inventory_quantity }}** left in stock
{% endif %}
From your Shopify admin, go to Online Store > Themes.
Find the Dawn 15 theme and click Actions > Edit code.
Edit the Product Template:
In the left-hand sidebar, find and open the product template file. This is typically located under Sections and is named main-product.liquid or similar.
Locate the section of the code where the inventory count is displayed. It might look something like this:
{% if product.available %}
{{ product.stock }} in stock
{% endif %}
Modify the code to include conditional logic that checks the inventory count. Here’s an example of how you can do it:
{% if product.available %}
{% if inventory_count <= 4 %}
{{ inventory_count }} in stock
{% endif %}
{% endif %}
save and test. this code is for the threshold of 4 products
Thank you. I have something similar that works in collections and I have tried both in place of the other code in main-product.liquid but I can’t get it to display. I think my best bet might be to integrate {% if inventory_count <= 4 %} into the existing code. I’m just not sure how.
{%- when 'inventory_count' -%}
{% if product.selected_or_first_available_variant.inventory_quantity <= block.settings.show_inventory_threshold or block.settings.show_inventory_threshold == 0 %}
Only **{{ product.selected_or_first_available_variant.inventory_quantity }}** left in stock
{% endif %}
I see. I’m upgrading from version 6 because some things were not working. I may just my update to version 11 for now because it was an easier update. Thank you for your help!
It seemed to be a theme issue for me. Perhaps I messed up an earlier theme or there was a conflict with an app but once I updated to Dawn 11, it went back to only showing the inventory under my chosen threshold. Good luck!