Return to Snippet

Revision: 72412
at August 19, 2017 21:53 by catswhocode


Initial Code
function add_to_cart_checkout_redirect() {
    wp_safe_redirect( get_permalink( get_option( 'woocommerce_checkout_page_id' ) ) );
    die();
}

add_action( 'woocommerce_add_to_cart', 'add_to_cart_checkout_redirect', 16 );

Initial URL
https://www.catswhocode.com/blog/super-useful-woocommerce-code-snippets

Initial Description
Automatically redirect users to the checkout page once a product has been added to the cart. This code should go to your functions.php file.

Initial Title
WordPress/WooCommerce - Redirect add to cart button to the checkout page

Initial Tags
wordpress

Initial Language
PHP