Redirect to checkout page after add to cart

To improve the sales conversions , you can automatically redirect to checkout page after adding product to cart by using the following code:

add_action( ‘add_to_cart_redirect’, ‘add_to_cart_checkout_redirect’, 16 );
function add_to_cart_checkout_redirect() {
    global $woocommerce;
    $checkout_url = $woocommerce->cart->get_checkout_url();
    return $checkout_url;
See also  Get Current Post Type in the WordPress Admin Area

Leave a Reply

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