I have a checkout extension that checks for bogus and bot checkouts. It basically wipes out the cart if it detects a bogus checkout.
In shopify, a checkout cannot be created if the email address is blank. So, it would be simpler to just wipe out the email address rather than deleting the items in the cart.
but neither of those seem to work. As a note, I don’t actually know what the “destroy” method does on this or any other api object that includes a destroy method. But I thought I’d give it a try.
Question 1. Is there a way to remove the email address?
Question 2. What does the destroy method do?
Interesting idea. But I don’t think that approach will work.
You cannot modify data directly on objects/variables returned from React hooks. React is one day data changes, meaning there’s a corresponding set[VariableName] for every reactive variable.
Shopify publishes React APIs to interact with the data.
If you’re trying to do this client side in the Checkout Extension, you can use the Buyer Journey Intercept API:
But, for server side coverage, you’ll need to publish a Cart or Checkout Validation Function to properly prevent bots from bypassing a block:
That’s not at all what I’m talking about. Bots are submitting checkout permalinks and then the checkout gets abandoned. So, we end up with abandoned carts and bogus customers, sometimes to the tune of a hundred an hour. That affects analytics, for one thing. They other thing it does is creates a bogus customer which gets added to our email marketing. That costs money when we send out marketing emails and we reach our limit in a given month.
I was simply looking for a way to remove the email address rather than emptying the cart. Emptying the cart works fine – the bogus abandoned checkout is not created which prevents creation of a customer. I was just looking for something a little more efficient.