How to go to cart page when clicking add to cart?

This topic has 2 replies, 2 voices, and was last updated 1 years, 9 months ago ago by Tony Rodriguez

  • Avatar: Stelio
    Stelio
    Participant
    March 26, 2023 at 20:56

    Could you help with the queries, please?

    1 – My store when clicking on the add to cart button does not change to any page. How to go to cart page when clicking add to cart?

    2- I would also like to know, optionally, how to go to the checkout page when I click on add to cart?

    Thanks

    1 Answer
    Avatar: Tony Rodriguez
    Tony Rodriguez
    Support staff
    March 27, 2023 at 06:18

    Hello @Stelio,

    1. We are pleased to inform you that the functionality you are looking for is already the default functionality of WooCommerce. To enable it, please go to WooCommerce >> Settings >> Products and check the option “Redirect to the cart page after successful addition” to YES. For your reference, please see the screenshot provided: https://postimg.cc/RJ5J7b92

    2. In order to redirect to the checkout page directly when clicking on the add to cart button, you may need to install a Child Theme on your site and add the following code to the Child theme’s functions.php file:

    function redirect_to_checkout_after_add_to_cart() {
    global $woocommerce;
    $checkout_url = $woocommerce->cart->get_checkout_url();
    return $checkout_url;
    }
    add_filter('woocommerce_add_to_cart_redirect', 'redirect_to_checkout_after_add_to_cart');

    Once you have saved your changes to the functions.php file, you should be able to redirect to the checkout page directly when clicking on the add to cart button.

    We hope this helps.

    Best Regards,
    8Theme’s Team.

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

The issue related to '‘How to go to cart page when clicking add to cart?’' has been successfully resolved, and the topic is now closed for further responses

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