Last active
July 22, 2020 08:52
-
-
Save sarangs07/7185e331223809e299b97407e3694537 to your computer and use it in GitHub Desktop.
Redirect to the checkout page instead of cart page. Works with any theme.
This file contains 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
/* | |
* How to add the custome code. | |
* | |
* Please follow below instructions: | |
* 1. Copy the below code. | |
* 2. Open your child theme's functions.php file. | |
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting. | |
*/ | |
// Trigure the action | |
add_filter('woocommerce_add_to_cart_redirect', 'redirect_add_to_cart'); | |
function redirect_add_to_cart() { | |
// Your checkout page URl | |
$cw_redirect_url_checkout = "add_your_checkout_page_url_here"; | |
// Return your URL. | |
return $cw_redirect_url_checkout; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment