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

On top of adding the code to your functions.php you also need to double check your WooCommerce settings, see screenshot below. Enjoy!

Force Redirection to WooCommerce Checkout on Add to Cart

1. WooCommerce Settings

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

WooCommerce Settings to Allow for Checkout Redirect

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

/**
 * @snippet       Redirect to Checkout Upon Add to Cart - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    Woo 3.8
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_filter( 'woocommerce_add_to_cart_redirect', 'bbloomer_redirect_checkout_add_cart' );

function bbloomer_redirect_checkout_add_cart() {
   return wc_get_checkout_url();
}
Share:

Leave a Reply