1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Exclude product IDs from global groups
  1. Home
  2. Knowledge Base
  3. Global Add-Ons
  4. Exclude product IDs from global groups
  1. Home
  2. Knowledge Base
  3. Advanced
  4. Exclude product IDs from global groups

Exclude product IDs from global groups

You can exclude certain products from global groups using this filter:

<?php
/**
* Exclude product IDs from global groups
*/
function prefix_exclude_product_ids( $verified, $product_id, $global, $rule ) {
// Specify your product IDs here
$product_ids = array( 123, 456 );
if( in_array( $product_id, $product_ids ) ) {
$verified = false;
}
return $verified;
}
add_filter( 'pewc_after_verify_all_products', 'prefix_exclude_product_ids', 10, 4 );
add_filter( 'pewc_after_pewc_verify_categories_rule', 'prefix_exclude_product_ids', 10, 4 );

Here’s how to insert the snippet.

Was this article helpful?

Related Articles