Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JeroenSormani/eef311b8c8cc3bf1a08a to your computer and use it in GitHub Desktop.
Save JeroenSormani/eef311b8c8cc3bf1a08a to your computer and use it in GitHub Desktop.
Don't apply coupon codes to sale products
<?php
function custom_wc_coupon_validity( $valid, $product, $this, $values ) {
if ( $product->is_on_sale() ) {
return false;
}
return $valid;
}
add_filter( 'woocommerce_coupon_is_valid_for_product', 'custom_wc_coupon_validity', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment