Stop selling before inventory hits zero

Pitchpro
Tourist
6 0 5

Hi,

 

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?

 

Cheers

Alan

0 Likes
ChuckWatson
Excursionist
21 2 2

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.

https://shopify.dev/docs/themes/liquid/reference/objects/variant/#variant.inventory_quantity

There's no meat in this?
0 Likes
JoesIdeas
Shopify Expert
1359 119 358

@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.

Founder of Speed Boostr (Shopify optimization experts, theme customization, custom app development).
Creator of Shopify Analyzer (first performance analysis tool for Shopify sites, free for the Shopify community).
Creator of Order Automator (auto tag orders and customers + auto fulfillment + more automations).
More apps: Theme Scientist (A/B testing), Tip Jar (add a tip button), File Optimizer (optimize CSS, JS, Liquid).
0 Likes
BAToys
Excursionist
16 0 5

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.  

0 Likes