Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasstark/ffd057dd57843a9399fe to your computer and use it in GitHub Desktop.
Save lucasstark/ffd057dd57843a9399fe to your computer and use it in GitHub Desktop.
Exclude Products from Dynamic Pricing Global Discounts
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'wcdp_exclude_specific_products', 10, 2 );
function wcdp_exclude_specific_products( $include, $product ) {
//Adjust this array accordingly. Alternatively use a product category.
$products_to_exclude = array(
1,
101,
717
);
if ( in_array( $product->id, $products_to_exclude ) ) {
$include = false;
}
return $include;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment