Change how inventory level shows on site

Hello!

I’m using the feature on Dawn theme to display inventory. I only want the inventory count to show if the item stock is equal or less than a quantity of 10.

How would I go about doing this in the code? Can someone please assist with this?

Thank you!

1 Like

@magikartcards you can edit product liquid file,

for product variant check inventory_quantity and

if this inventory_quantity is less than 10 then display the number.

1 Like

Hello @magikartcards

Steps to Display Inventory Count Only When Stock is 10 or Less

  1. Go to your Shopify Admin
  2. Navigate to Online Store > Themes
  3. Click on Customize for your active theme
  4. Click on Edit Code
  5. Find and open the file: main-product.liquid
  6. Look for the existing inventory display code, usually within {% if product.variants.first.inventory_quantity > 0 %}
  7. Replace or modify it with the following:
{% if current_variant.inventory_quantity <= 10 and current_variant.inventory_quantity > 0 %}

Hurry! Only {{ current_variant.inventory_quantity }} left in stock.

{% endif %}
1 Like

Hi, thank you for the response. I am having trouble finding the right area to change this code.

My website is:

https://magikartcards.com/

Would you be able to assist with finding the right spot to paste the code? There is no password. I appreciate your help!

How would I do this? I don’t know the right area to edit the code.

@magikartcards if you can accept me as collaborator then I can check it and let you know

Here is the request code 4664

@magikartcards - what is your website link?

https://magikartcards.com/

@magikartcards - can you please share a product whose inventory is less than 10?

@magikartcards - please check DM

1 Like