WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_REST_Products_V1_Controller::get_variation_data() protected WC 1.0

Get an individual variation's data.

Это метод класса: WC_REST_Products_V1_Controller{}

Хуков нет.

Возвращает

Массив.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_variation_data( $product );
$product(WC_Product) (обязательный)
Product instance.

Код WC_REST_Products_V1_Controller::get_variation_data() WC 4.5.2

woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php
<?php
protected function get_variation_data( $product ) {
	$variations = array();

	foreach ( $product->get_children() as $child_id ) {
		$variation = wc_get_product( $child_id );
		if ( ! $variation || ! $variation->exists() ) {
			continue;
		}

		$variations[] = array(
			'id'                 => $variation->get_id(),
			'date_created'       => wc_rest_prepare_date_response( $variation->get_date_created() ),
			'date_modified'      => wc_rest_prepare_date_response( $variation->get_date_modified() ),
			'permalink'          => $variation->get_permalink(),
			'sku'                => $variation->get_sku(),
			'price'              => $variation->get_price(),
			'regular_price'      => $variation->get_regular_price(),
			'sale_price'         => $variation->get_sale_price(),
			'date_on_sale_from'  => $variation->get_date_on_sale_from() ? date( 'Y-m-d', $variation->get_date_on_sale_from()->getTimestamp() ) : '',
			'date_on_sale_to'    => $variation->get_date_on_sale_to() ? date( 'Y-m-d', $variation->get_date_on_sale_to()->getTimestamp() ) : '',
			'on_sale'            => $variation->is_on_sale(),
			'purchasable'        => $variation->is_purchasable(),
			'visible'            => $variation->is_visible(),
			'virtual'            => $variation->is_virtual(),
			'downloadable'       => $variation->is_downloadable(),
			'downloads'          => $this->get_downloads( $variation ),
			'download_limit'     => '' !== $variation->get_download_limit() ? (int) $variation->get_download_limit() : -1,
			'download_expiry'    => '' !== $variation->get_download_expiry() ? (int) $variation->get_download_expiry() : -1,
			'tax_status'         => $variation->get_tax_status(),
			'tax_class'          => $variation->get_tax_class(),
			'manage_stock'       => $variation->managing_stock(),
			'stock_quantity'     => $variation->get_stock_quantity(),
			'in_stock'           => $variation->is_in_stock(),
			'backorders'         => $variation->get_backorders(),
			'backorders_allowed' => $variation->backorders_allowed(),
			'backordered'        => $variation->is_on_backorder(),
			'weight'             => $variation->get_weight(),
			'dimensions'         => array(
				'length' => $variation->get_length(),
				'width'  => $variation->get_width(),
				'height' => $variation->get_height(),
			),
			'shipping_class'     => $variation->get_shipping_class(),
			'shipping_class_id'  => $variation->get_shipping_class_id(),
			'image'              => $this->get_images( $variation ),
			'attributes'         => $this->get_attributes( $variation ),
		);
	}

	return $variations;
}