Stop selling before inventory hits zero

Shopify Partner
6 0 6



I've hunted high and low and can't find a solution. On our old system, we were able to set a product to stop selling online once inventory hit a certain number. Shopify allows stop selling at zero which in a perfect world would be fine. Consider the following scenarios:


1. We have 1 item of stock left and a customer has picked it up in store to purchase. At the same time an internet customer tries to purchase and it is "available" but in reality it is not. Is there any way to get around this.

2. Same scenario but this time the inventory is showing 1 when in fact there are none due to a small inventory error. Let's face it, with Shopify's crazy notion that exchanges can only happen when customers have a receipt, this is a frequent occurrence when relying on staff to manually update inventory.


Either of the above scenarios (and others to be fair) result in orders we can't fulfill and angry customers which we desperately want to avoid.


Has anyone found a workaround?




Replies 7 (7)

21 2 3

You'd have to edit the liquid file for your shop that shows products.

When looping through the variants you can grab the inventory and then subtract X (whatever you think the buffer should be) and then trigger the "sold out" view using that number.

There's no meat in this?
Shopify Expert
2119 190 562

@Pitchpro  sounds like you have 2 possible solutions:


A) Elaborating on Chuck's recommendation, here's a code example you can share with your developer, they should be able to extrapolate from that to edit your code:

<!-- Inside your variant loop -->
{% if variant.inventory_quantity < 5 %}
  apply the CSS class or code you use to prevent a variant from being selected.
{% else %}
  show the regular code you already have
{% endif %}

<!-- Another way to do it (my prefered way), is adding a sold out class, and then using CSS / JavaScript to style it and prevent ordering it -->
<div class="variant{% if variant.inventory_quantity < 5 %} sold-out{% endif  %}">this is the variant box, selector, etc.</div>


B) More expensive solution, but more accurate is to build a custom app that syncs the inventory. For example, if someone in the store purchases an item, have it subtract the inventory in your Shopify online store. If you're not using Shopify POS, or your software doesn't have the ability to send outgoing API requests, you (or my team or another developer) could build a basic web app that employees can log into, select the product, and adjust the inventory so it updates in your Shopify store.

The fun thing about custom apps like that, I've seen it so many times where a store owner asks us to build a custom app for 1 specific feature, then they get more ideas and it evolves into suite of features that help organize their business in various aspects.

• Creator of Order Automator (automate tagging, fulfillment, Amazon, notifications + more)
• Shopify developer for 10+ years, store owner for 7 years
• I also make guides like Shopify Automation Tips and How to Deal with Fraud / Chargebacks
16 0 33

Agreed- there are too many scenarios to mention that this is nearly a requirement for... the fact that it is not built-in is almost unacceptable.  It should be very easy for Shopify to add a field to products of "orderable" and then it can be set to true or false...  It's amazing that Shopify thinks it's the best place to sell on earth- yet they lack the most standard of options on the platform.  

2 0 0

Hi @Pitchpro 


Did you ever manage to find an app to be able to fulfill your request?


I have the exact same problem.



1 0 0

Are you looking for an app that simply allows you to mark a product as sold out manually (like a checkbox on the product)? Or rather one that marks products to be sold out once inventory hit a certain number that you can specify?

2 0 0

Hi @showbird 


Yes I’d like it to be marked as OOS when it hits a certain number (1 in most cases) 



2 0 0

did you ever find out a workaround for this?