When you have just a single product, the cart page is not really necessary and instead, you want that page to take users to the product page instead.

Instead of creating a redirect with an external plugin, we wanted to just change the link of the “Return to Shop” button.


One Google search later, I’ve found this great snippet by Rodolfo Melogli.

The above snippet will help you change the link from the cart page to the homepage. But we’ll take it one step further and add any URL that you want.

In this example the link will be ‘

Where to add this snippet?

I suggest using a plugin such as Code Snippets

As an alternative, you can add the snippet directly in your child theme functions.php file.

Was this post helpful?

    Leave a Comment

    We use cookies to provide an awesome experience on our website. By continuing to use this site, you agree to our tasty cookies.
    🍪 Accept Cookies
    Privacy Policy