Last active
March 23, 2020 07:10
-
-
Save Njengah/4a2adae25c30d8bd2e810290f829e503 to your computer and use it in GitHub Desktop.
WooCommerce Skip Cart and Redirect to Checkout - https://njengah.com/skip-cart-and-redirect-to-checkout-woocommerce/
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
<?php | |
/** | |
* Skip Cart and Redirect to Checkout | |
* Add to functions.php of child theme | |
*/ | |
add_filter('woocommerce_add_to_cart_redirect', 'njengah_skip_cart_redirect_to_checkout_page'); | |
function njengah_skip_cart_redirect_to_checkout_page() { | |
global $woocommerce; | |
// Remove the default `Added to cart` message | |
wc_clear_notices(); | |
return $woocommerce->cart->wc_get_checkout_url(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment