Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::get_variations_of()privateWC 1.0

Get the variations of a given variable product.

Метод класса: LookupDataStore{}

Хуков нет.

Возвращает

Массив. An array of WC_Product_Variation objects.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_variations_of( $product );
$product(\WC_Product_Variable) (обязательный)
The product to get the variations for.

Код LookupDataStore::get_variations_of() 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
	);
}