WooCommerce Checkout Redirect After Adding Product To Cart On Archive

WooCommerce product arhive redirecting to checkout when adding a product to cart


For this functionality to work on the product archive page, you’ll need to disable “Enable AJAX add to basket buttons on archives” under WooCommerce > Settings > Products . General > Add to cart behaviour.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

This quick guide shows you how you can redirect your customers to the checkout after they immediately add a product to their cart from the product archive page. This sort of process would be tailored only to a few stores where perhaps only one product can be bought at a time.

* Snippet Name:   Redirect users to the checkout page when they add a product to cart on the single product page
* Snippet Author: ecommercehints.com

add_filter( 'woocommerce_add_to_cart_redirect', 'ecommercehints_add_to_cart_checkout_redirect' );

function ecommercehints_add_to_cart_checkout_redirect() {
   return wc_get_checkout_url();

Snippet Benefits

  • Skip the single product and cart page completely, reducing the number of steps and effort the user has to make in order to become a paying customer.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

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

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers