WooCommerce: Redirect to Checkout on Add to Cart

Here’s how you force redirection to the checkout every time a product is added to cart, no matter if you do so from the loop/shop pages or the single product page.

1. WooCommerce Settings to allow for Redirect to Checkout on Add to Cart

Go to WooCommerce > Settings > Products > Display and disable both options: “Redirect to the cart page after successful addition” & “Enable AJAX add to cart buttons on archives”:


2. PHP Snippet: Redirect to Checkout on Add to Cart – WooCommerce

* @snippet Redirect to Checkout Upon Add to Cart - WooCommerce
* @author Codify.Club
* @compatible WC 3.3.3
function codifyclub_redirect_checkout_add_cart( $url ) {
   $url = get_permalink( get_option( 'woocommerce_checkout_page_id' ) ); 
   return $url;
add_filter( 'woocommerce_add_to_cart_redirect', 'codifyclub_redirect_checkout_add_cart' );
You can place PHP snippets at the bottom of your child theme functions.php file (before “?>” if you have it).


Developer, Technology aficionado, Beer Lover and founder of Network. Who shares a keen interest about website development, health issues, cancer awareness and other fun stuff.

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed