Hide Product based on distance from a specific location.

ZakariaM
Tourist
7 0 2

I have a client that needs some products in his store to be hidden if the customer's location is further than a specific distance from the physical store address (or even better the delivery address he enters at checkout, since they could be buying it for somebody else).

What is the best way to access the delivery information and check them against an API to get the distance from the physical store, before allowing the customer to proceed with checkout?

What is the best approach for this? Do I have to create a private app for them or some javascript in the liquid files will do? Or do I have to build a custom checkout with the storefront API?

0 Likes
Elias
Shopify Staff
Shopify Staff
1044 100 152

Hey, @ZakariaM.

Elias here from Shopify Support. That's a great question!

You can use our free app, Fraud Filter, to block certain customers from checking out using rules based on their IP addresses, countries, or states. However, it's important to note that the rules are applied to the cart during the checkout process, so this doesn't offer the option to block specific products. If you're interested in trying out this app, we've also got a guide that can help you with setting up the Fraud Filter rules

That being said, if you need to block certain products from customers before the checkout stage, I did find a third-party app that can do this - called Geoip Product Blocker. If you need any help with this app, the app developer is always available to assist you - you can reach out to the developer directly through the contact information found in the Support section of their app's page. 

Was there a specific reason that you need to block certain products as opposed to blocking countries or states?

Elias | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
ZakariaM
Tourist
7 0 2

Thank you for the reply!

I think I could develop a similar app to Fraud Filter, that has more customised functionality regarding products. But still that would be a bad solution to offer to a merchant, since they would keep losing money (on transaction fees) every time the app cancels an order and they would have to refund it. Since, if I'm not mistaken, once the customer reaches the order_status page, the payment has already gone through.

Is there a way to stop the payment from going through programmatically?

So that I could check if there is a marked product in the line_items and if the address entered for shipping doesn't pass the filter, I stop the order before it gets to payment or before the transaction goes through.

Thanks a lot and I hope I solution can be found!

0 Likes