mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
9 lines
346 B
Text
9 lines
346 B
Text
add_filter( 'woocommerce_coupon_is_valid_for_product', 'wc_exclude_product_from_product_promotions_frontend', 9999, 4 );
|
|
|
|
function wc_exclude_product_from_product_promotions_frontend( $valid, $product, $coupon, $values ) {
|
|
// PRODUCT ID HERE (E.G. 12345)
|
|
if ( 12345 == $product->get_id() ) {
|
|
$valid = false;
|
|
}
|
|
return $valid;
|
|
}
|