Product Archive

WooCommerce Checkout Redirect After Adding Product To Cart On Archive

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

Pre-Requisites

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.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 10% off on your first month with us.

26027
WELCOME OFFER