PressTigers

How to change ‘Return To Shop’ URL in WooCommerce Shopping Cart

According to a research, WooCommerce is recommended as the best shopping cart plugin for WordPress websites. You may require to customize a well supported e-Commerce solution for your online store according to your will/choice.

If your cart is empty and have no products left, on the same page you see a button “Return To Shop” which by default redirects you to the shop page. But you can customize it by changing its URL.

WooCommerce provides a filter “woocommerce_return_to_shop_redirect”. To make this customization in URL, you need to use this filter and add the following code in your theme’s function.php file:

User Comments

2 thoughts on “How to change ‘Return To Shop’ URL in WooCommerce Shopping Cart

    Hi,

    Thanks for sharing. It worked for my site. Can I change the URL for “Continue shopping” button too? I tried using the following but failed. Appreciate your advice.

    function wc_continue_shopping_redirect_url() {
    return ‘https://tutornauts.com.sg/our-courses’;
    }
    add_filter(‘woocommerce_continue_shopping_redirect’, ‘wc_continue_shopping_redirect_url’);

    Regards,
    Alfred

    admin says:

    The Continue Shopping by default redirects the customer back to the product page that recently added to cart. If you’d like the change that redirect link, Add this code in your theme’s/Child theme’s functions.php file.

    /**
    * Redirect the Continue Shopping URL from the default (most recent added product) to
    * a custom URL.
    */
    function pt_continue_shopping_redirect_url($url) {
    $url = “http://www.url.com”; // Add your custom link here
    return $url;
    }

    add_filter(‘woocommerce_continue_shopping_redirect’, ‘pt_continue_shopping_redirect_url’);

Leave a Reply

Your email address will not be published. Required fields are marked *

    Get in Touch