Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Hide child products in parent product page under grouped product in WooCommerce

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I wish to hide these child products

>Solution :

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>";
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading