In the past we discussed about how to change the Return to Shop button URL in the Empty Cart page. Today we will learn how to change the Continue Shopping button URL always on the cart page.
This button appears when the option Redirect to the cart page after successful addition is selected in WooCommerce > Settings > Products > General > Shop pages > Add to cart behaviour.
The necessary snippet is quite short, requiring only one line even:
You can add a layer of complexity and return a different link, maybe conditionally by using a full function instead of an anonymous one, like so:
This would allow you to add conditions to your function so that you can maybe redirect to a different page based on what product is added to the cart, or based on the user role. Use your imagination!
Contribute to Improving This Blog
Did you enjoy this article? Was it helpful? Contribute to help me writing more articles! The funds collected from this blog are reinvested directly into improving my skills or the blog so that I can provide more and better content!
Make a one-time donation
Make a monthly donation
Make a yearly donation
Choose an amount
Or enter a custom amount
Your contribution is appreciated.
Your contribution is appreciated.
Your contribution is appreciated.
DonateDonate monthlyDonate yearlyDo you prefer using cryptocurrency? I’ve got you covered! You can donate at the following wallets:
- BTC: bc1q87nxpdpqw323ccmerrzyeffs72wnxpw93x7pzk / 17Gtc5e8yoh2LZzokoyK8P5DWbToBwztok
- ETH: 0xA5C89Be1df2896C3942DBEf751cCeacC7929388b
Leave a Reply