How to Redirect to the Checkout Page on Add to Cart for Woocommerce

In this little snippet I’m going to show you a very simple way to redirect your customers to the checkout page on add to cart. There are a few possible scenarios that you might need to use this snippet. For instance, if you are selling avirtual product such as a course, or a downloadable product like an audio file or plugin. There really is no need for buyers to access the cart page, and every time they have to press a button there’s a risk of losing them as a paying customer. So let’s take a look at how simple this really is.

Disable ajax and redirection to cart page

The first step that you need to take is to head to Woocommerce > settings > product and under the general tab make sure both redirect to cart page after successful addition and redirect to cart page are unchecked.

Once both boxes are unchecked as in the image above, click save at the bottom of the page.

Adding the snippet to redirect to checkout page on add to cart


* snippet Redirect to checkout page on add to cart for WooCommerce
* sourcecode
* author John Cook
* tested Woocommerce 3.3.3

add_filter( 'woocommerce_add_to_cart_redirect', 'wcsuccessacademy_redirect_to_checkout_on_add_cart' );

function wcsuccessacademy_redirect_to_checkout_on_add_cart( $url ) {
$url = get_permalink( get_option( 'woocommerce_checkout_page_id' ) );
return $url;


Where do you place the code?

Place the code snippet into your theme functions file, child theme functions file or functions plugin. Make sure it is placed before the closing ?> if you have it in your file. If you are uncertain how to place this, please use one of the plugins found in this list.

Did this plugin work for you?

Please leave a comment letting me know if the code snippet showing how to redirect customers to the checkout page on add to cart has worked for you.

0 0 votes
Article Rating
Written by John Cook
I've been using WordPress for over 6 years and Woocommerce for over 4 years. In that time I have explored the depths of customizations and helped many online retailers grow and expand their business using the Woocommerce selling platform. My aim here is to help enable Woo users around the globe get even more out of their e-commerce platform of choice.