Redirect to Specific URL on Coupon Removal in WooCommerce

Here is a simple way to redirect a user to a specific page when they remove a WooCommerce coupon from the cart page. Useful for example if you want to show content to users who remove a coupon that was automatically added to the cart. Here is how:

/*
 * 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 );
Discussion
[  0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!