WooCommerce: Redirect user to a specific page after removing a coupon
This snippet gives the ability to redirect a user after removing a coupon. You can place the code in functions.php
.
This snippet gives the ability to redirect a user after removing a coupon. You can place the code in functions.php
.
<?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 ); |