How to redirect user directly to checkout page after adding product to cart in Woocommerce?

In this tutorial we’ll learn how to redirect user directly to checkout page when they add a product to cart from product detail / single product page.

By default, when a user add a product to cart they first need to go to cart page and from there they can proceed to checkout.

Now to move users directly to checkout page, add the following lines of code at the end of you theme’s functions.php file:

add_filter ('add_to_cart_redirect', 'redirect_to_checkout');

function redirect_to_checkout() {

   return WC()->cart->get_checkout_url();


You can access functions.php file here:


Save the file by clicking on update file button after placing the above code.

Now if you click on add to cart button from single product page you’ll be redirected directly to the checkout page.




About the author

We provide WordPress & WooCommerce Support, Maintenance and Development Services.

Leave a Reply