Last active
March 23, 2021 17:47
-
-
Save rynaldos-zz/1e4abb14c0000fd19b431e62e5a28595 to your computer and use it in GitHub Desktop.
[WooCommerce] Redirecting from add-to-cart to checkout page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function my_custom_add_to_cart_redirect( $url ) { | |
| $url = WC()->cart->get_checkout_url(); | |
| // $url = wc_get_checkout_url(); // since WC 2.5.0 | |
| return $url; | |
| } | |
| add_filter( 'woocommerce_add_to_cart_redirect', 'my_custom_add_to_cart_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment