Skip to content

Instantly share code, notes, and snippets.

@CmdrMahesh
Forked from corsonr/README.md
Created November 12, 2019 08:25
Show Gist options
  • Save CmdrMahesh/7438d8cee64924384c49da2eefb83e3d to your computer and use it in GitHub Desktop.
Save CmdrMahesh/7438d8cee64924384c49da2eefb83e3d to your computer and use it in GitHub Desktop.
WooCommerce: redirect user upon coupon removal
<?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