Solved

Multi-Location Local Pickup and Delivery Only Store Issues

pythagoryan
Excursionist
21 0 9

Hey all,

 

I'm struggling a bit to engineer a solution for this one. Any insight or advice would be appreciated.

 

Right now I'm working on an online store for 11 retail stores. We only need local pickup and delivery, no shipping whatsoever. The main problem is order validation. There's no built-in or third party method that I can find which will allow users to select a location, build an order based on the inventory for that location, and seamlessly take that order through checkout with pickup/delivery for that location.

 

Right now, customers have to hope (and ideally check first) that all the items they want are available at a single location. If not (which I foresee being a common occurrence) then the checkout page will bug out and never fully load. There's not even an error message. 🤦

 

From what I can tell this is because the Shopify API doesn't allow software to pull data regarding product/variant inventory levels by location, but rather just total inventory.

 

I'm wracking my brain for a way to achieve this goal but I don't see any easy solution for this. I'm so perplexed; does Shopify not use/test its own platform? I assume that this lack of functionality is a dealbreaker for many businesses. Additionally, API access to location-specific inventory seems like it would be a great idea as it would allow large businesses to much more easily connect their Shopify inventory to third-party delivery apps.

 

Thanks in advance y'all.

Ryan R. Irwin
Director of Technology
SkyCo Distro & Hazel Sky Smoke Shop
Accepted Solution (1)
beauxbreaux
Shopify Partner
183 14 32

This is an accepted solution.

Hmmm. I feel like maybe something like having an API retrieve all your warehouse locations then display the inventory of each location on the product page instead of just 1 inventory could work. Then you would need to then handle the inventory adjustment once a person purchases with another call. You would probably want some kind of reminder of which address to pick up at in the checkout as well. If your locations are pretty close together I would also probably only show the user 3 of the closest locations with inventory. I was digging around in the documentation earlier and playing with some ideas. I know it can be done but would require some app development. It is wild that this is even a thing. Seems like this is something that needs to be out of the box already available. If I do come up with a solution I will pass it along but might take some time to figure out. Throw any ideas my way.

Beaux Barker
Developer

View solution in original post

Replies 7 (7)

beauxbreaux
Shopify Partner
183 14 32

Check out these guys: https://www.zapiet.com/shopify/store-pickup-delivery

Looks like they do validation for inventory based on geolocation.

Beaux Barker
Developer
beauxbreaux
Shopify Partner
183 14 32

I will keep thinking of some possible free solutions. If these people can create an app that does what you need, there has got to be a way. 

Beaux Barker
Developer
pythagoryan
Excursionist
21 0 9

I've looked at this app! I'm not sure if geolocation will be ideal for us since all of our stores are generally in the same area of one city... but I'll give it a shot!

Ryan R. Irwin
Director of Technology
SkyCo Distro & Hazel Sky Smoke Shop
beauxbreaux
Shopify Partner
183 14 32

This is an accepted solution.

Hmmm. I feel like maybe something like having an API retrieve all your warehouse locations then display the inventory of each location on the product page instead of just 1 inventory could work. Then you would need to then handle the inventory adjustment once a person purchases with another call. You would probably want some kind of reminder of which address to pick up at in the checkout as well. If your locations are pretty close together I would also probably only show the user 3 of the closest locations with inventory. I was digging around in the documentation earlier and playing with some ideas. I know it can be done but would require some app development. It is wild that this is even a thing. Seems like this is something that needs to be out of the box already available. If I do come up with a solution I will pass it along but might take some time to figure out. Throw any ideas my way.

Beaux Barker
Developer
pythagoryan
Excursionist
21 0 9

Zapiet ended up working up well enough with one of their more premium plans. Thanks!

Ryan R. Irwin
Director of Technology
SkyCo Distro & Hazel Sky Smoke Shop

tobebuilds
Shopify Partner
184 10 58

Hi Ryan,

 

It sounds like what you're looking for is a way to:

  1. Allow users to select one of your store locations.
  2. After a location is chosen, prevent customers from seeing products with no inventory at the selected location on collection pages.
  3. Also, prevent customers from adding products with no inventory at the selected location to their cart.

If so, then a solution might be possible. However, it would be complex, and have several moving parts:

 

1. Allowing users to select one of your store locations

You can probably create a custom Liquid page template, with a list of all your store locations. When the user selects a location, you can store its ID as a cart attribute for later reference.

 

You might consider also editing the product page template, to disable the add to cart button if the customer hasn't selected a location.

 

2. Determine which products are unavailable at the current location.

This would be the hardest part.

 

The `location` object in Liquid doesn't have a way to check inventory levels AFAIK: https://shopify.dev/docs/api/liquid/objects/location

 

However, the Admin GraphQL API `Location` object has an `inventoryLevel()` property you can use to check the inventory level of a specific item at that location: https://shopify.dev/docs/api/admin-graphql/2023-10/objects/Location#field-location-inventorylevel

 

The hard part would be to communicate between the GraphQL API and your pages. You might need an app (either a custom app or a public app) that gets called in an AJAX request in the next steps.

 

It's not as clean as pure Liquid, unfortunately.

 

3. Prevent customers from seeing unavailable products on collection pages.

If you do an AJAX call as mentioned above, you can then dynamically apply CSS styles to hide unavailable products on the site.

 

For example, you could use `display: none` to hide them entirely. Or if that's too jarring/janky, you can gray out the images for unavailable products, and display a badge/banner saying "Unavailable at this location."

 

4. Also, prevent customers from adding unavailable products to their cart.

You would need to edit the product page template to also add an AJAX call. If the product is unavailable at the current location, you can dynamically disable the "Add to cart" button and add a message to it.

 

If you are on Shopify Plus, then you can go one step further and use the Cart/Checkout Validation Functions API to prevent customers from checking out entirely, if they have an unavailable item in their cart.

 

If so, then I recommend:

  • In step 3 above, add a line item property to each line item in the customer's cart, containing the selected location's current inventory level of that product.
  • In your cart/checkout validation function, check that every line item has this property, and that its value > 0. If not, reject the cart with an error message.

 

---

 

Let me know if this sounds like it would meet your needs. I'm always looking for opportunities to build new public Shopify apps.

 

And if you build this functionality in-house, then I hope the information I provided has been useful.

 

- Tobe

Founder / Developer, Regios Technologies, Inc.
Install my automatic discounts app
DM me for custom app development and consulting.
tobebuilds
Shopify Partner
184 10 58

Update: You might be able to use an app proxy to make it easier to communicate with the theme and your API:

 

https://shopify.dev/docs/apps/online-store/app-proxies

Founder / Developer, Regios Technologies, Inc.
Install my automatic discounts app
DM me for custom app development and consulting.