Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::get_variations_of()privateWC 1.0

Get the variations of a given variable product.

Method of the class: LookupDataStore{}

No Hooks.

Return

Array. An array of WC_Product_Variation objects.

Usage

// private - for code of main (parent) class only
$result = $this->get_variations_of( $product );
$product(\WC_Product_Variable) (required)
The product to get the variations for.

LookupDataStore::get_variations_of() code WC 8.7.0

private function get_variations_of( \WC_Product_Variable $product ) {
	$variation_ids = $product->get_children();
	return array_map(
		function( $id ) {
			return WC()->call_function( 'wc_get_product', $id );
		},
		$variation_ids
	);
}