New Landing How can we help? Atelier Change link of "Return to shop"

Viewing 15 posts - 1 through 15 (of 17 total)
  • Posted in: Atelier
  • #305942
    teddyden
    Member
    Post count: 195

    Hi,

    How can I change the redirect url to “return to shop”(in empty cart/checkout) and “continue shopping” in cart?
    Thanks

    #305973
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Those links are automatically connect to the shop page that is defined in Woocommerce.
    But Guess it can be changed with the code below.

    
    /**
     * Changes the redirect URL for the Return To Shop button in the cart.
     *
     * @return string
     */
    function wc_empty_cart_redirect_url() {
    	return 'http://yourdomain.com/your-page/';
    }
    add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' );
    

    Add it to the functions.php of the child theme.

    -Rui

    #306083
    teddyden
    Member
    Post count: 195

    Thanks

    #306089
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    No problem.

    -Rui

    #326217
    lauries
    Member
    Post count: 63

    Hi,
    I’ve tried a couple different codes that you’ve supplied on this forum to redirect the url from the ‘Continue Shopping’ link. This one is currently active but it’s not working for me. Can you advise? Thanks!

    #326290
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    @lauries

    That code should work fine. Where did you placed the code?
    It should be inside the functions.php of the child theme.

    -Rui

    #326759
    lauries
    Member
    Post count: 63

    Hi Rui,

    It is inside the functions.php of the child theme as you directed.

    I noticed that this redirect URL does work on the ‘My Account/Downloads’ page when clicking on the ‘Go Shop’ button (there is nothing downloaded here yet). However, it doesn’t work from the cart page when there are items in the cart…? Would I have to alter the code you recommended because the words ‘function wc_empty_cart_redirect_url’ are in the code?

    Thanks (see attached).

    Attachments:
    You must be logged in to view attached files.
    #326945
    David Martin – Support
    Moderator
    Post count: 20834

    Are you on the latest WC and theme versions? Be sure they are updated.

    Will need a link/login to check your setup.

    #326958
    teddyden
    Member
    Post count: 195
    This reply has been marked as private.
    #326996
    lauries
    Member
    Post count: 63
    This reply has been marked as private.
    #327245
    David Martin – Support
    Moderator
    Post count: 20834

    Just to confirm:

    However, it doesn’t work from the cart page when there are items in the cart

    – you want to change the cart link if items are in the cart?

    The above code is only for an empty cart.

    #327271
    lauries
    Member
    Post count: 63
    This reply has been marked as private.
    #327458
    David Martin – Support
    Moderator
    Post count: 20834

    I see, so that link is set to your Shop page that you set in WooCommerce => Settings => Products => Display => Shop & product pages => Shop page

    #327488
    lauries
    Member
    Post count: 63

    Thank you so much; i would’ve never figured that out 🙂

    #327509
    David Martin – Support
    Moderator
    Post count: 20834

    Glad to help, strangely WooCommerce have many options like that very well hidden.

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register