w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Fetch child products in grouped products woocommerce

Use the get_children() method in the WC_Product_Grouped class.

$product_id = 8; // ID of parent product
$product = get_product( $product_id );
$children = $product->get_children();

It should return an array of product IDs.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.