This topic has 2 replies, 2 voices, and was last updated 1 years, 8 months ago ago by Tony Rodriguez
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
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.
Tagged: add to cart, cart page, seo friendly, templates, woocommerce, wordpress
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