Home Forums WoodMart support forum Hide linked products in group and subcategories

Hide linked products in group and subcategories

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #230513

    twangmodular
    Participant

    Hi.

    I am using grouped products. But the catalog is a dump of a heap of products linked to a group.
    How do I hide linked products and their subcategories?
    I use the code in function.php to hide the products:

    function custom_hide_tags( $query ) {

    $children = get_term_children( $query->queried_object_id , ‘product_tag’ );

    $tax = $query->get( ‘tax_query’);
    $tax[] = array(
    ‘taxonomy’ => ‘product_tag’,
    ‘field’ => ‘id’,
    ‘terms’ => ‘subcat’,
    ‘operator’ => ‘NOT IN’,
    );

    $query->set( ‘tax_query’, $tax );
    }
    add_action( ‘woocommerce_product_query’, ‘custom_hide_tags’);

    On the screenshot, subcategory with hided products

    Attachments:
    You must be logged in to view attached files.
    #230547

    Hello,

    Thank you very much for choosing our theme and for contacting us.

    Products types are the Woocommerce functionality and our theme does not influence the default Woocommerce. Please refer to the documentation as our support does not cover the Woocommerce customization.

    Best Regards

Viewing 2 posts - 1 through 2 (of 2 total)