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

WC_Product_Variable_Data_Store_CPT::read_children() public WC 1.0

Loads variation child IDs.

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

Хуки из метода
Возвращает

Массив.

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

$WC_Product_Variable_Data_Store_CPT = new WC_Product_Variable_Data_Store_CPT();
$WC_Product_Variable_Data_Store_CPT->read_children( $product, $force_read );
$product(WC_Product) (обязательный) (передается по ссылке — &)
Product object.
$force_read(true/false)
True to bypass the transient.
По умолчанию: false

Код WC_Product_Variable_Data_Store_CPT::read_children() WC 4.7.1

<?php
public function read_children( &$product, $force_read = false ) {
	$children_transient_name = 'wc_product_children_' . $product->get_id();
	$children                = get_transient( $children_transient_name );

	if ( empty( $children ) || ! is_array( $children ) || ! isset( $children['all'] ) || ! isset( $children['visible'] ) || $force_read ) {
		$all_args = array(
			'post_parent' => $product->get_id(),
			'post_type'   => 'product_variation',
			'orderby'     => array(
				'menu_order' => 'ASC',
				'ID'         => 'ASC',
			),
			'fields'      => 'ids',
			'post_status' => array( 'publish', 'private' ),
			'numberposts' => -1, // phpcs:ignore WordPress.VIP.PostsPerPage.posts_per_page_numberposts
		);

		$visible_only_args                = $all_args;
		$visible_only_args['post_status'] = 'publish';

		if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) ) {
			$visible_only_args['tax_query'][] = array(
				'taxonomy' => 'product_visibility',
				'field'    => 'name',
				'terms'    => 'outofstock',
				'operator' => 'NOT IN',
			);
		}
		$children['all']     = get_posts( apply_filters( 'woocommerce_variable_children_args', $all_args, $product, false ) );
		$children['visible'] = get_posts( apply_filters( 'woocommerce_variable_children_args', $visible_only_args, $product, true ) );

		set_transient( $children_transient_name, $children, DAY_IN_SECONDS * 30 );
	}

	$children['all']     = wp_parse_id_list( (array) $children['all'] );
	$children['visible'] = wp_parse_id_list( (array) $children['visible'] );

	return $children;
}