When shopping on a website, driven by WordPress and WooCommerce, sometimes you want your users to just return directly to the shop. Rather than having the user search for the shop navigation button, you want to give them a button, as soon as they add a product to the cart.
The trick is that what you may not want to a direct button on the page, regardless of any action. Now, I am not sure about you, but for me, I want to make sure that I am not redirecting off the product page itself, unless the action of ‘add to cart’ has been taken by the user.
When adding a product to the cart from the single product page, you are often greeted with a message that asks you if you want to now go directly to the cart and thus checkout. What if you wanted to also offer a way to greet the use with a ‘Continue Shopping’ and return them back to the full shop page? Sound like a good idea? To me it did, so I sat down and wrote this little piece of code.
We will use the
wc_add_to_cart_message – WooCommerce hook to add a shiny new button to the added to cart message.