Go Straight to Checkout After Adding to Cart
Skips the cart page and sends customers directly to checkout after they add a product, for single-product or quick-purchase stores.
Opens WPIDE on
Code
add_filter( 'woocommerce_add_to_cart_redirect', function () {
return wc_get_checkout_url();
} );
Notes
Turn off "Enable AJAX add to cart buttons on archives" in WooCommerce > Settings > Products so shop buttons redirect too.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.