Display only grouped products in related products

This topic contains 1 reply, has 2 voices, and was last updated by WCFM Forum WCFM Forum 2 weeks, 4 days ago.

  • Author
    Posts
  • #103689
    Avatar
    paattal
    Participant

    Hello,

    I use this woocommerce snippet to display only grouped products in all woocommerce page :

    add_filter( 'woocommerce_product_query_tax_query', 'only_grouped_products', 20, 1 );
    function only_grouped_products( $tax_query ){
        $tax_query[] = array(
            'taxonomy'  => 'product_type',
            'field'     => 'name',
            'terms'     => array('grouped'),
        );
        return $tax_query;
    }

    That’s works fine on store page and I thought have the same feature in single product but not, all store products are still displayed in related products.

    Can you help me.

    Thank you

  • #105737
    WCFM Forum
    WCFM Forum
    Keymaster

    Hi,

    all store products are still displayed in related products.

    – You have to use separate query filter for related products.

    Thank you

You must be logged in to reply to this topic.