WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\BlockTypes

ProductCategories::fill_category_children() protected WC 1.0

Build hierarchical tree of categories by appending children in the tree.

{} It's a method of the class: ProductCategories{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->fill_category_children( $categories, $categories_by_parent );
$categories(array) (required)
List of terms.
$categories_by_parent(array) (required)
List of terms grouped by parent.

Code of ProductCategories::fill_category_children() WC 5.7.0

protected function fill_category_children( $categories, $categories_by_parent ) {
	foreach ( $categories as $category ) {
		if ( ! empty( $categories_by_parent[ 'cat-' . $category->term_id ] ) ) {
			$category->children = $this->fill_category_children( $categories_by_parent[ 'cat-' . $category->term_id ], $categories_by_parent );
		}
	}
	return $categories;
}