Saturday , August 19 2017
Home / Developers / Filter only grouped products on your wordpress woocommerce shop page

Filter only grouped products on your wordpress woocommerce shop page

Add this to your function.php  file or to your child theme’s function.php file. It will show only grouped products on your shop page.

//Hook
add_action( ‘woocommerce_product_query’, ‘grouped_product_query’ );
function grouped_product_query( $arguments ){
$product_type = array(
‘taxonomy’ => ‘product_type’,
‘field’ => ‘name’,
‘terms’ => ‘grouped’
);
$arguments->set(‘tax_query’, array($product_type) );
$arguments->set( ‘post_parent’, 0 );
}

Check Also

Programming language used by famous companies

Programming language used by famous companies

List of programming languages used by famous companies to build their famous products.