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

WC_AJAX::load_variations() public WC 1.0

Load variations via AJAX.

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

Хуков нет.

Возвращает

Null. Ничего.

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

$result = WC_AJAX::load_variations();

Код WC_AJAX::load_variations() WC 4.7.1

<?php
public static function load_variations() {
	ob_start();

	check_ajax_referer( 'load-variations', 'security' );

	if ( ! current_user_can( 'edit_products' ) || empty( $_POST['product_id'] ) ) {
		wp_die( -1 );
	}

	// Set $post global so its available, like within the admin screens.
	global $post;

	$loop           = 0;
	$product_id     = absint( $_POST['product_id'] );
	$post           = get_post( $product_id ); // phpcs:ignore
	$product_object = wc_get_product( $product_id );
	$per_page       = ! empty( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : 10;
	$page           = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
	$variations     = wc_get_products(
		array(
			'status'  => array( 'private', 'publish' ),
			'type'    => 'variation',
			'parent'  => $product_id,
			'limit'   => $per_page,
			'page'    => $page,
			'orderby' => array(
				'menu_order' => 'ASC',
				'ID'         => 'DESC',
			),
			'return'  => 'objects',
		)
	);

	if ( $variations ) {
		wc_render_invalid_variation_notice( $product_object );

		foreach ( $variations as $variation_object ) {
			$variation_id   = $variation_object->get_id();
			$variation      = get_post( $variation_id );
			$variation_data = array_merge( get_post_custom( $variation_id ), wc_get_product_variation_attributes( $variation_id ) ); // kept for BW compatibility.
			include __DIR__ . '/admin/meta-boxes/views/html-variation-admin.php';
			$loop++;
		}
	}
	wp_die();
}