Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

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.

Our team at Themelocation is comprised of WordPress developers of high expertise

  • We can maintain, support and manage your single, or all your clients, website with dedication
  • Our skills are at your disposal.

Book a Call

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:

woocommerce

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.

woocommerce

woocommerce

CHEERS J

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

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