Location-Based Stock Availability on the Front End

DOB
Excursionist
13 0 8

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 15 (15)
greeney2k1
Shopify Partner
15 0 3

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 8

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 8

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
Shopify Staff
21 1 13

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 8

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 2

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
New Member
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
New Member
1 0 2

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

Dadan1
New Member
1 0 0

Any update here Rohit? 

PeteOswald
Excursionist
21 0 17

Also really keen on this functionality

www.littledifference.org
1 Card = 1 Tree
bigskyintl
Excursionist
21 0 15

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
15 0 3

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 5

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
21 0 15

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

ShopStore201
Excursionist
12 0 40

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.