WordPress at a glance
function is not described

WC_REST_Product_Variations_V2_Controller::batch_items() public WC 3.0.0

Bulk create, update and delete items.

{} It's a method of the class: WC_REST_Product_Variations_V2_Controller{}

No Hooks.

Return

Array. Of WP_Error or WP_REST_Response.

Usage

$WC_REST_Product_Variations_V2_Controller = new WC_REST_Product_Variations_V2_Controller();
$WC_REST_Product_Variations_V2_Controller->batch_items( $request );
$request(WP_REST_Request) (required)
Full details about the request.

Changelog

Since 3.0.0 Introduced.

Code of WC_REST_Product_Variations_V2_Controller::batch_items() WC 5.0.0

<?php
public function batch_items( $request ) {
	$items       = array_filter( $request->get_params() );
	$params      = $request->get_url_params();
	$query       = $request->get_query_params();
	$product_id  = $params['product_id'];
	$body_params = array();

	foreach ( array( 'update', 'create', 'delete' ) as $batch_type ) {
		if ( ! empty( $items[ $batch_type ] ) ) {
			$injected_items = array();
			foreach ( $items[ $batch_type ] as $item ) {
				$injected_items[] = is_array( $item ) ? array_merge(
					array(
						'product_id' => $product_id,
					), $item
				) : $item;
			}
			$body_params[ $batch_type ] = $injected_items;
		}
	}

	$request = new WP_REST_Request( $request->get_method() );
	$request->set_body_params( $body_params );
	$request->set_query_params( $query );

	return parent::batch_items( $request );
}