Blocking a customer. Will this code work in blocking?

I have a “customer” John Doe, that keeps abandoning carts. Will this code work in dawn theme to block him and if so, where do I place it? Pictures attached to show some of what he is doing, and the code is below that image.

Hi @cvette :waving_hand: It will only work if it’s a person/bot that goes through the bother of clicking a button on the website.
It varies wildly among themes uou’d basically find the part of code that renders the buy-buttons and wrap it in that logic. Or the buy-button snippet itself if it’s modular and uses in different places like collection prouct-grids etc.
Like for dawn themes you’d go into section main-product.liquid and wrap the buy-button rendering used for the blocks switching logic.

If your not sure reach where and need customize services then reach out ( :speaking_head: click profile pic on forums for options to connect).

Bot sophistication

If their using the browser automations, the ajax api, or permalinks etc this simple theme mods won’t even be a roadbump.

So you’d still want to have backend process in place to limited the bad actors impact , such as preventing triggering other processes like discount campaigns etc.
Though currently there’s no api way to delete abandoned carts.

If you know a clear way to identify them during the checkout process then also look at cart-validation apps using shopify-functions.

Thank you for responding. What is your best solution/recommendation?

If it’s just one or two then do iteratively with minimal time, just try the liquid logic you have.
If it continues then you know it’s not gonna stop because a customer is registered and tagged.

If it’s alot of bad actors eating time as a big opportunity cost, then trawl the app store for apps to test.