Skip to content

Instantly share code, notes, and snippets.

@leewillis77
Last active September 15, 2020 08:35
Show Gist options
  • Save leewillis77/6031ae65f269d1fe6488ddb4fd15483b to your computer and use it in GitHub Desktop.
Save leewillis77/6031ae65f269d1fe6488ddb4fd15483b to your computer and use it in GitHub Desktop.
Change exclusion for specific products in Google Product Feed
<?php
function lw_gpf_exclude_product($excluded, $product_id, $feed_format) {
// Do not exclude any of the specified product IDs.
if ( in_array( $product_id, [ 28 ] ) ) {
return false;
}
// Standard behaviour for all other products.
return $excluded;
}
add_filter( 'woocommerce_gpf_exclude_product', 'lw_gpf_exclude_product', 11, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment