Change RETUNR TO SHOP button link in empty cart

Hello,

Is it possible to change the link of the RETURN TO SHOP button when the cart is empty?


If yes, how do you do it?
Thanks

Hi Giuseppe,

Thanks for reaching out.
You can change the Return to Shop button URL by overriding the WooCommerce hook woocommerce_return_to_shop_redirect using a custom PHP code into the child theme’s functions.php.

function change_url_of_empty_cart() 
{
        $url = 'http://example.com/sample-page'; // change this link as per your need
        return esc_url( $url );
}
add_filter( 'woocommerce_return_to_shop_redirect', 'change_url_of_empty_cart' );

Please remember that the above code will work if copied as it is and doesn’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We really do not provide support for custom codes that means we can’t fix it in case it conflicts with something on your site nor will we enhance it.

You can find more details about it at the following URL.

https://www.businessbloomer.com/woocommerce-change-return-shop-url/

Thanks

Ok thanks Tristup. I have already customized the CSS a lot in the Cornerstone CSS editor, if I now load and activate a child theme will I lose these styles?
Thanks

Hi Giuseppe,

The Child theme will not affect any of those custom CSS or any styling using any settings.

Thanks

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.