Solved

Limiting Visible Quantity for items (ie. "More than 10 available" instead of 500 in stock)

akim307
New Member
4 0 0

Hello, I'm looking to keep the available quantity displaying if the quantity is 1 - 10 and after 10 it would say "More than 10 in stock". Basically I don't want customers to see if I have extremely large quantities of some items. Is there an easy fix for this? 

Accepted Solution (1)

SomeUsernameHe
Shopify Partner
440 48 81

This is an accepted solution.

Access Your Theme Code:

Go to your Shopify admin panel.
Click on 'Online Store' and then 'Themes'.
Find your current theme and click 'Actions', then 'Edit code'.
Find the Product Template:

In the theme editor, look for the file that handles the product page. This is usually named product.liquid or product-template.liquid. However, it might vary depending on your theme.
Edit the Code:

In the product template, find the section where the inventory quantity is displayed. It might look something like {{ product.available }} or {{ variant.inventory_quantity }}.
Replace or modify this section with an if-else statement. Here’s a simple example in Liquid:

{% if variant.inventory_quantity > 10 %}
  More than 10 in stock
{% else %}
  {{ variant.inventory_quantity }} in stock
{% endif %}



Have I helped? Consider putting coffee in my mouth!
Buy Me a Coffee

View solution in original post

Replies 5 (5)

SomeUsernameHe
Shopify Partner
440 48 81

What theme are you using? 

Have I helped? Consider putting coffee in my mouth!
Buy Me a Coffee
akim307
New Member
4 0 0

Electro 02 1280

SomeUsernameHe
Shopify Partner
440 48 81

This is an accepted solution.

Access Your Theme Code:

Go to your Shopify admin panel.
Click on 'Online Store' and then 'Themes'.
Find your current theme and click 'Actions', then 'Edit code'.
Find the Product Template:

In the theme editor, look for the file that handles the product page. This is usually named product.liquid or product-template.liquid. However, it might vary depending on your theme.
Edit the Code:

In the product template, find the section where the inventory quantity is displayed. It might look something like {{ product.available }} or {{ variant.inventory_quantity }}.
Replace or modify this section with an if-else statement. Here’s a simple example in Liquid:

{% if variant.inventory_quantity > 10 %}
  More than 10 in stock
{% else %}
  {{ variant.inventory_quantity }} in stock
{% endif %}



Have I helped? Consider putting coffee in my mouth!
Buy Me a Coffee
akim307
New Member
4 0 0

My theme's product template is product.json.  The code for the inventory is:

     "show_inventory_quantity": true,
     "inventory_threshold": 9,

How should I edit this code to fix this?

SomeUsernameHe
Shopify Partner
440 48 81

Jason files usually just contain the settings. You need to look for a .liquid file that deals with the product page. Maybe main_product?

Have I helped? Consider putting coffee in my mouth!
Buy Me a Coffee