/ Published in: PHP
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function add_to_cart_checkout_redirect() { wp_safe_redirect( get_permalink( get_option( 'woocommerce_checkout_page_id' ) ) ); } add_action( 'woocommerce_add_to_cart', 'add_to_cart_checkout_redirect', 16 );
URL: https://www.catswhocode.com/blog/super-useful-woocommerce-code-snippets