This snippet gives the ability to redirect a user after removing a coupon. You can place the code in functions.php
.
Last active
September 25, 2022 09:17
-
-
Save corsonr/ae2611b9ac34bec1a3c1fbb1c8432b04 to your computer and use it in GitHub Desktop.
WooCommerce: redirect user upon coupon removal
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
<?php // Do not include this if already open! Code goes in theme functions.php. | |
/* | |
* Redirects user to a specific page upon coupon removal. | |
*/ | |
function action_woocommerce_removed_coupon( $coupon_code ) { | |
// Redirection... | |
wp_redirect( $url ); // Replace $url by your page URL. | |
exit; | |
}; | |
// add the action | |
add_action( 'woocommerce_removed_coupon', 'action_woocommerce_removed_coupon', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment