Let me start by saying sorry that this title is somewhat vague. More specifically the title should be:
How to select the behavior of the “add to cart” button in a woocommerce Storefront theme (probably other themes as well) product archives page (aka shop page), such that it adds the item to the cart and then either stays on the shop page, or redirects to the cart.
But that is a long title…
Redirected To Custom URL :
Redirect To Checkout :
Redirect For Certain Categories :
According to the official WooCommerce documentation
You will find in tab Products, section ‘Display’, the checkbox that does what you need: [ ] Redirect to the cart page after…
Cheers.
There may be a way to do this with woocommerce hooks and filters, but after spending some time trying to solve this problem that way, I stumbled across the easy solution which was not entirely obvious at first.
The Solution:
Check or uncheck the “Enable AJAX add to cart buttons on archives” button under WooCommerce > Products > Display > Add to Cart Behavior section of the WP admin area.
That is apparently exactly what this button is for, however, it seems to me that the title of this checkbox is very misleading and is why it took me so long to find this solution. It should probably be changed to something more like: “Redirect to the cart page after successful addition from archive (shop)”. The use of the acronym AJAX is unnecessary and very misleading as to the effect of the checkbox…