Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/7b322e7f904f601a3c8100db89b404bd to your computer and use it in GitHub Desktop.
Save plugin-republic/7b322e7f904f601a3c8100db89b404bd to your computer and use it in GitHub Desktop.
<?php
/**
* Add different product types
*/
function prefix_ptuwc_query_product_type( $tax_query, $args, $table ) {
$product_types = array( 'grouped' ); // Add your custom post types here as a comma separated list
if( $tax_query ) {
foreach( $tax_query as $index=>$arg ) {
if( isset( $arg['taxonomy'] ) && $arg['taxonomy'] == 'product_type' ) {
// Check the taxonomy given
$tax_query[$index]['terms'] = array_merge( $tax_query[$index]['terms'], $product_types );
}
}
}
return $tax_query;
}
add_filter( 'ptuwc_query_tax-query', 'prefix_ptuwc_query_product_type', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment