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?
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?
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!