src/WooCommerce/Invoice/CreatorPluginSupport.php
protected function groupBundles(array $itemLines)
    {
        $result = array();
        foreach ($itemLines as &$itemLine) {
            if (!empty($itemLine[Meta::BundleParentId])) {
                // Find the parent, note that we expect bundle products to
                // appear before their bundled products, so we can search in
                // $result and have a reference to a line in $result returned!
                $parent = &$this->getParentBundle($result, $itemLine[Meta::BundleParentId]);
                if ($parent !== null) {
                    // Add the bundled product as a child to the bundle.
                    $parent[Meta::ChildrenLines][] = $itemLine;
                } else {
                    // Oops: not found. Store a message in the line meta data
                    // and keep it as a separate line.
                    $itemLine[Meta::BundleParentId] .= ': not found';
                    $result[] = $itemLine;
                }
            } else {
                // Not a bundled product: just add it to the result.
                $result[] = $itemLine;
            }
        }
        return $result;
    }
protected function groupBundles(array $itemLines)
    {
        $result = array();
        foreach ($itemLines as &$itemLine) {
            if (!empty($itemLine[Meta::BundleParentId])) {
                // Find the parent, note that we expect bundle products to
                // appear before their bundled products, so we can search in
                // $result and have a reference to a line in $result returned!
                $parent = &$this->getParentBundle($result, $itemLine[Meta::BundleParentId]);
                if ($parent !== null) {
                    // Add the bundled product as a child to the bundle.
                    $parent[Meta::ChildrenLines][] = $itemLine;
                } else {
                    // Oops: not found. Store a message in the line meta data
                    // and keep it as a separate line.
                    $itemLine[Meta::BundleParentId] .= ': not found';
                    $result[] = $itemLine;
                }
            } else {
                // Not a bundled product: just add it to the result.
                $result[] = $itemLine;
            }
        }
        return $result;
    }
protected function groupBundles ( array $ itemLines ) { $ result = array ( ) ; foreach ( $ itemLines as & $ itemLine ) { if ( ! empty ( $ itemLine [ Meta :: BundleParentId ] ) ) { // Find the parent, note that we expect bundle products to // appear before their bundled products, so we can search in // $result and have a reference to a line in $result returned! $ parent = & $ this -> getParentBundle ( $ result , $ itemLine [ Meta :: BundleParentId ] ) ; if ( $ parent !== null ) { // Add the bundled product as a child to the bundle. $ parent [ Meta :: ChildrenLines ] [ ] = $ itemLine ; } else { // Oops: not found. Store a message in the line meta data // and keep it as a separate line. $ itemLine [ Meta :: BundleParentId ] .= ': not found' ; $ result [ ] = $ itemLine ; } } else { // Not a bundled product: just add it to the result. $ result [ ] = $ itemLine ; } } return $ result ; }
Groups bundled products into the bundle product.

@param array $itemLines
The set of invoice lines that may contain bundle lines and bundled
lines.

@return array
The set of item lines but with the lines of bundled items
hierarchically placed in their bundle line.
Groups bundled products into the bundle product .