Home > Mobile >  Hide child products in parent product page under grouped product in WooCommerce
Hide child products in parent product page under grouped product in WooCommerce

Time:02-23

Most past answers are about hiding child items from listing and search results. I'm trying to hide the child items from the parent product page.

The reason is I'm doing a modification to allow something like "Buy 1 Free 1" in grouped products, meaning if you buy parent item, you get child item too! No need to click on child item and add it to the cart. It's "forced" into your cart.

I know I can use WooCommerce Chained Products but another plugin I'm using is not compatible with it.

I wish to hide these child products

CodePudding user response:

Add this in your active theme functions.php

add_action('wp_footer', 'wc_product_display_css_overrides');

function wc_product_display_css_overrides() {
    echo "<style>.woocommerce-grouped-product-list{ display:none;}</style>";
}
  • Related