Cart Page - by JohnSpratt - on WordPress WooCommerce support

This topic has 6 replies, 2 voices, and was last updated 6 years, 11 months ago ago by Rose Tyler

  • Avatar: JohnSpratt
    JohnSpratt
    Participant
    January 24, 2018 at 14:21

    Hello,
    I’m needing to change the link when you click on the cart and it’s empty. Currently it take the person back to shop page but I want to make it take them back to the homepage. Is this possible and if so how?

    5 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 24, 2018 at 14:30

    Hello,

    Try to use this code in functions.php of child theme:

    /**
     * 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' );

    Regards

    Avatar: JohnSpratt
    JohnSpratt
    Participant
    January 24, 2018 at 14:40

    Hello,

    Tried this but it’s not working unfortunately

    Please, contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 24, 2018 at 15:10

    Hello,

    Oh I see, you need to copy xstore/woocommerce/cart/cart-empty.php file into xstore-child/woocommerce/cart/ folder and make changes according to these screenshots
    http://prntscr.com/i4xrzq
    http://prntscr.com/i4xs77

    Regards

    Avatar: JohnSpratt
    JohnSpratt
    Participant
    January 24, 2018 at 16:24

    Sorry to sound silly what do you mean copy? I’m no good with all this stuff lol

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 24, 2018 at 16:34

    Hello,

    You need to create cart-empty.php file in child theme, that has the same content as this file in the parent theme, and make changes here. Please read more about child theme functionality – https://codex.wordpress.org/Child_Themes

    Regards

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.