A recent predicament we received involved a client whose main requirement was to not allow clients to purchase products across states. Even after they created specific shipping locations, Shopify would still show customers the product is in stock, whereas in reality the product was out of stock in the state the user was visiting from.
How to find the state?
Our solution involved using a geolocation service to pinpoint the state, making sure the Shopify locations were written exactly as the output from the geolocation service. The output was a JS variable from a JSON response.
Display front-end version of inventory quantity per location
Once we had this variable, we used a Shopify application in a hidden display that shows inventory per location on the front-end (something Shopify doesn't allow via Liquid natively weirdly).
Disable Add To Cart & Other Logic
Result is a site that checks user's state, sets inventory status according to stock in location and not globally while also allowing users to only purchase the limited stock in that location.
Do you have a requirement similar to this? Let us know and we'll be happy to help you get this done swiftly!