Location-Based Stock Availability on the Front End

DOB
Excursionist
13 0 10

Hello Shopify community -

We are currently selling internationally and we have two warehouses using Shopify's built-in location-based inventory feature. We are also using Shopify's geolocation app. Everything works well for our logistics (who are using the API to only pull orders they ship to), however one issue we keep running in to is stock availability on the front end.

Obviously the front end is displaying something in stock if the combined inventory between both locations is >0. What we would like to do is to set up rules to show a product as out-of-stock to customers visiting from certain countries, IF that product is out-of-stock in the warehouse location we would ship to them from.

The simplest form of this logic would be:

if [customer] is in [list of countries] then show "add to cart", else show "out of stock".

 

A more complex/automated version would pull inventory count on a per-location basis (rather than the total inventory) and show the appropriate button, but that would be a bonus not a necessity. I am already aware of an app (GeoIP Blocker) that will hide products based on geoIP rules, however this would hide the product entirely from these visitors including our "back in stock" notification button which we want to avoid.

Is there any way that we can integrate this using JS/Liquid rather than an app/private app? I don't mind having to modify the code regularly to include/exclude specific products in the logic as we don't often run out of stock but it does happen and it would be great if we could set a product as out of stock based on IP when the need arises.

 

Thanks in advance for your thoughts, and please let me know if you require further explanation!

Replies 29 (29)

greeney2k1
Shopify Partner
28 1 7

did you find a fix for this? 

the only way I could think of a fix is as follows.... 

1) Setup shipping rate for the UK postage
2) Setup shipping rate for EU postage
3) Duplicate your store inventory 
4) Assign original store inventory to UK postage rate
5) Assign duplicated inventory to EU postage rate
6) Set stock levels on all products manually for UK & EU to ensure accuracy
7) Use an IP blocker to hide products for certain countries - Recommended app - https://apps.shopify.com/geoip-based-product-blocker - $6.99 per month - this way if someone from the EU visits your store they will only see the EU products with accurate stock levels and someone from the UK will only see UK products with UK stock levels 
 
Not ideal if you have 000's of SKU's ... but it should work 
DOB
Excursionist
13 0 10

Hey there - I tried the IP blocker app but it loads the script from an external server and sometimes the products would show for up to 3-4 seconds before hiding. This was noticeable enough for customers that we got rid of it. Also my thought process was that if we're going to duplicate our entire inventory we might as well just go the official "clunky" route and have multiple stores...but that means a lot of extra monthly fees.

One solution I'm working on right now is using Product Inventory Information which is an app that will display multiple inventories divided across your warehouse locations on the front end. It inserts a div with unique classes for in stock, out of stock etc. and also has a geolocation feature so you can define who will see which location depending on their country. Out of the box it doesn't do what we need, BUT it does separate the inventory display on the front end and crucially injects the app's unique "outofstock" class into the page.

I'm hoping that with a bit of custom JS/jquery, I can have a script hosted locally search the page for the "outofstock" class the app inserts, and then manually set the add to cart button to inactive through JS. Not sure your level of coding is, but I have a JSFiddle with the general concept working on a simple HTML button, I just need to integrate it with Shopify: https://jsfiddle.net/gradivis/16Lnzqf5/2/

Again it's not ideal (if I can get it working), and would much prefer to do it through Shopify's geolocation app (that we're already using for currency and language). Would be relatively straight forward for them, rather than having multiple geolocation calls loading through separate apps.

 

DOB
Excursionist
13 0 10

For anyone coming in from Google, I just wanted to add the GENERAL code we're currently using in the hope that it might prove useful. I really wish this was included as standard in Shopify - it's still strange to me that handling inventory internationally was not included in their cross-border sales push, as it's pointless to serve a customer a website in their language and currency but not be able to serve them localised inventory levels.

 

As mentioned earlier, we are using TomIT's excellent inventory app to enable front-end display of geolocated inventory. This injects a DIV into the front-end that is geolocated and separated according to your Shopify locations. It's a great start, but it often means that you are showing for example "EU Inventory = 0" while still allowing EU customers to click "add to cart".

My addition is not exactly elegant (as it's not a language I've studied) but I made a little bit of JS that runs to check to see what inventory status Tom's app is injecting, and then changes the add-to-cart button based on that status (over-riding Shopify's use of total inventory for add to cart/out of stock buttons). It can sometime take a second or two to load since it's waiting for Tom's app to inject the inventory status, but it works as long as the visitor can be geolocated.

@Thomas_Lang1- do you think this sort of feature (being able to modify the add-to-cart button functionality when your geolocated inventory shows out of stock) could be added to your very useful app?

 

 

 

 

setInterval(function(){
  var t=document.getElementsByClassName("tomItInventoryLocationNoStock")[0].innerHTML;
  if(t="Currently Sold Out"){
  	var b=document.getElementsByClassName("add-to-cart")[0].setAttribute("disabled","disabled");
    var c=document.getElementsByClassName('add-to-cart')[0].innerText = 'SOLD OUT';
  }
  console.log(t);
},0);

 

 

 

 

rohitmishra
Shopify Staff
21 2 14

Hey all, 

I work on cross-border commerce at Shopify and I wanted to acknowledge that this is an issue that we are looking in to. 

I do not have an estimated timeline at the moment. If others in this thread have related use cases, feel free to add here. 

- Rohit 

Product Lead, Global Commerce and Sales Tax
DOB
Excursionist
13 0 10

Rohit,

Thanks so much for your response! I'm thrilled to know it has been acknowledged and that you're looking in to it. It truly is a huge part of cross-border commerce, and a significant portion of our cancelled transactions are due to stock being unavailable in a customer's shipping zone, despite them being able to purchase an item as total inventory across locations is >1.

Since a lot of your cross-border customers are using the Geolocation app for Shopify payments I think it would be a great line to follow in using the existing browser geolocation call to then deliver accurate inventory levels as well as currency. This would be the most streamlined approach in my opinion anyway, although I'm more UX/UI than back-end.

Really hope that this is something you and your team can find a solution for - it's really the only source of headaches we've had since switching to Shopify and I can only imagine the increase in market share you would see from International companies like ours who aren't jumping over to Shopify just yet. We had a working (custom) solution on Woocommerce and I know it's on BigCommerce's roadmap right now...first person with an out-of-the-box working solution is going to snap up a LOT of new business! Just my 2 cents 🙂

 

 

Harmony
Tourist
4 0 3

That's great, especially now with Brexit. We have EU and UK locations and it's a mess for customers importing from opposite location.

nicolewwj
Visitor
1 0 0

Thank you so much for your thorough explanation of this multiple-warehouses issue and your work-through. I also found this problem to be quite a headache for me and my customers. I'm looking into using the Product Inventory app and hire a coder to do some customisation so that the warehousing info is not displayed on the product page but does trigger the "out-of-stock" label and toggle off the "add to cart" button.

I would appreciate to hear about any update if you happen to find even a better solution?

 

Thanks!

TritonNoirFab
Visitor
1 0 3

Hi,

We are using Shopify since 2014 but as soon as we needed to have advanced control on how we deal with location based restrictions in conjunction with inventory management we had to move to WooCommerce.

It's quite sad that as of today, 7 years later, Shopify does not provide a satisfying solution for cross border multi warehouse stores.

Our needs:

  • One store
  • Selling the same products worldwide
  • Product variations (languages)
  • 5 Warehouses serving different countries or US states
  • Inventory managed per Warehouse
  • Multi currency
  • Multi Language
  • Availability of a product to a given customer is based on shipping address country/state (linked to a specific warehouse).

As of today, we are using custom made (badly developed) plugin on WooCommerce for the products and Shopify for a small portion of our catalog. 

I can(t find an app that does all that correctly.

We would definitely strongly consider jumping back to Shopify if we had a robust solution (that does not require advanced coding).

Fabrice

ShopStore201
Excursionist
14 0 76

Unfortunately the same issue. Becoming really disheartned with how much we are paying and how the platfrom still lacks basic functionality. We have stock sat in the UK we can't sell because customers can add items to the their cart which we don't sell in the UK. It's a disaster.

 

The apps don't work either, in addition to the fact they're an extra cost on top of our subscription and other apps we have to use to get access to very basic functionality like effective website customization. 

bigskyintl
Excursionist
34 0 20

We are still having this issue... it is very frustrating... we hope Shopify will fix this issue soon.

Dadan1
Visitor
1 0 0

Any update here Rohit? 

PeteOswald
Excursionist
42 0 2

Also really keen on this functionality

www.littledifference.org
1 Card = 1 Tree
bigskyintl
Excursionist
34 0 20

We have a problem with warehouses in different countries:

- we use Shopify multiple locations feature,

- we also have geolocation app installed so we know what country our customer is located.. it will display our web site in their language and currency.

1) we have 3 warehouse locations: USA, Asia, and EU

2) We a) track inventory, and b) box is NOT checked to continue selling when out of stock

3) For example, if our Asia warehouse is out of something, we would like Shopify to show "out of stock" for orders shipping from Asia warehouse... but Shopify appears to allow item to be sold AND to go negative for that location. This does make sense to us...

I would think Shopify would: if box is NOT checked to continue selling when out of stock to

1) state product is "out of stock" for that location, or

2) have an option to ship from a different location, then that location inventory would be deducted (not deduct from a location that does not have inventory).

To us it does not make sense to have a) track inventory, and b) box is NOT checked to continue selling when out of stock, then allow inventory to go negative

Any comments?

Note 1: we do not want to "hide" product... we want out-of-stock product showing so customer can use "Notify Us When Available" feature. ("hide" feature may be an option for some stores, we just do not want to do it this way.)

Note 2: we will look at https://apps.shopify.com/product-inventory-information app but it would nice if something like this would be included with Shopify

Thank you for your help,

Bob

www.BigSkyInternational.com

 
greeney2k1
Shopify Partner
28 1 7

You've done everything correctly with the locations and stock - the only missing step is having custom shipping settings from each location which will solve the shipping issues 

Setting up the shipping locations individually will allow you to apply the correct pricing at cart 

MackJon
Excursionist
26 0 30

Hi Bob,

This sounds like exactly the same problem I'm currently having to workaround.

https://community.shopify.com/c/International-Commerce/Bug-in-multi-warehouse-stock-tracking-and-shi...

Apparently, it's something that should be resolved this year, from what I've read with the Shopify dev working on it.

For now, I'm currently running lots and lots of shipping profiles and manually having to move stock between them to make sure we don't get the negative stock level. Products can either be available in the UK, EU, RotW or 2 of these, or of course - all 3!

Jon

bigskyintl
Excursionist
34 0 20

Thanks for your reply... yes, a big mess.. while we can move inventory from one warehouse to another, for example: from UK warehouse to USA warehouse, our customers are not happy... asking us, "Why did you take my order for USA delivery if the product is in the UK?"

We hope shopify quickly fixes this...

Bob

ReneWasabi
Tourist
4 0 0

It is May 2023 now, and I don't think this has become integrated into Shopify? I guess the thinking of Shopify is to be 'Global' and have items flown across the globe to fulfil all orders at any time. Very eco haha. I send a big box with stock to the US to fufil local orders and when we run out of an item here, then Shopify allows it to be sent from the US back to Europe. Yeah, awesome 😏

tuhkana
Tourist
3 0 8

Hey Rohit (or anyone else on the cross-border commerce team),

 

Any updates regarding this request? It would be great to have the stock availability on the front end based on the user's location.

bruce1976
Tourist
5 0 1

Hi mate, any update on this? We really need a solution!!

 

StuartM
Tourist
4 0 1

Hi Rohit,

 

Any update here as this functionality is labeled as 'coming soon' on the markets feature page?

internationalec
Visitor
2 0 1

We're extremely frustrated with this issue. It's been present for a long time and to us seems like a core, fundamental feature which is missing. Our solution so far is to use the Multi Inventory Location app and paid web developers to use that API on our front end. While it works for PDP pages, it still means 99% of other app integrations we use are broken when it comes to displaying inventory numbers. Also, orders still slip through the Multi Inventory solution we have, meaning we must process refunds and have annoyed customers leading to negative reviews. 
With the release of Markets and worldwide pricing options based on location, I am baffled this is still an issue. I have contacted Shopify probably around 5 times now over the course of 9 months - they told me in December 2022 it would be ready for Q1 2023. I've just reached out again now and I get a vague, useless response "We can't tell you what development is being done, all we can say is it is under review", despite them telling me it should've been ready months ago. Extremely disappointed, does Shopify understand logistics at all? Even a simple check in the checkout process with shipping country against shipping & delivery settings and product location would suffice for now...

bruce1976
Tourist
5 0 1

found an app, I guess it does the job

app is called "Product Inventory Information"

 

 

MilaTatyanina
Tourist
5 0 4

Hi DOB, hi everyone, I have exactly the same problem: 2 Markets: US and EU, and 2 corresponding fulfillment centers (US and EU) with separate inventories for the same products. The problem with Shopify Markets is that if I have product A available either in the US OR in the EU, then Shopify makes it available for purchase in BOTH Markets, regardless of where the user is shopping from.

NOW Today, as of July 29 2023 I have tested my set up and just discovered that it WORKS PROPERLY!!

I wonder am I hallucinating Shopify has fixed it? Is it related to the Shopify Markets Pro feature, which I requested an early access to? (I heard nothing back from Shopify)? Is this true?? I can't believe that Shopify made it right. Is it related the the batch of new updates they released in Shopify Summer Editions 2023? 

 

If anyone could confirm that multi-location products appears properly "sold-out" on those markets where it has 0 inventory, I'll be very grateful! 🙏🏻 

 

Here is an example.

Product A Inventory: US - 0; EU - 5;

Product B Inventory: US - 3; EU - 0;

Product C Inventory: US - 0; EU - 0;

Here is my requirement:

For a customer from the US, products A and C should appear as “SOLD OUT”

For a customer from the EU, products B and C should appear as “SOLD OUT”

The former Shopify implementation up to this date was that for ANY customers, only Product C appears as “SOLD OUT”. Both Products A and B were available for purchase, regardless of customer location (that essentially ruined the idea of international markets).

Today I tested it again and Shopify works CORRECTLY, per my requirements: For a customer from the EU, products B and C should appear as “SOLD OUT”.

HKUK
Tourist
5 0 7

Yes, they fixed it!!!
Under the product details in shopify. now you can hide the product from specific markets.

MilaTatyanina
Tourist
5 0 4
Well, this won’t help, the product should become sold out based on the inventory in this specific market.
HKUK
Tourist
5 0 7

I know, it's not ideal but at least this solution offers a way to continue selling products in one market while hiding it in others.

StuartM
Tourist
4 0 1

This has not been my experience, we still have the issue.

 

Also - you could turn off the availability of a product in the market you are OOS in, but this doesn't help when it's one variant that your OOS in (to my knowledge you still can't control marketing availability at the variant level), plus making something invisible is far from ideal.

lempac
Visitor
1 0 0

Exactly the same issue until Shopify release their markey feature coming soon.

 

A work around I have found is using geo stock by inventory app on the app store. It can relpicate the behaviour we're looking for based on location.

happy-day
Visitor
1 0 0

We're still waiting for shopify's "market specific fulfillment" which has been coming soon for a very long time! For now, what does everyone think about this (cumbersome) workaround? Duplicate / copy products to create separate products with separate inventories and assign them to different markets.  This means that the product is only shown to customers shopping from that market/ region so the inventory should be maintained at each location separately. Would this have any issues with SEO & duplicate content or sometimes showing two copies of the product if the user is unable to be geolocated?