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

WooCommerce default option that allow for Redirect to all users to the cart after adding a product to the cart. You can find the option in the WooCommerce -> Settings -> Products -> Display area. When the option “Redirect to the cart page after successful addition” is checked. It will redirect all users to the cart after adding a product to the cart.

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 following lines code at the end of your theme’s functions.php file of your active child theme (or theme) and Save the file to redirect user directly to checkout page after adding product to cart in Woocommerce.

function custom_add_to_cart_redirect( $url ) {
	$url = WC()->cart->get_checkout_url();
	return $url;
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );
Scroll to Top