Automattic\WooCommerce\Internal

ScheduledSaleRun::process_batch │ private │ WC 1.0

Prime, process, and release one batch.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->process_batch( $batch_ids ): void;
$batch_ids(int[]) (обязательный)
Product ids in this batch.

Код ScheduledSaleRun::process_batch() WC 11.3.0

private function process_batch( array $batch_ids ): void {
	_prime_post_caches( $batch_ids );

	// Capture post types before product saves evict the primed posts.
	$post_types = array_values( array_unique( array_filter( array_map( 'get_post_type', $batch_ids ) ) ) );

	foreach ( $batch_ids as $product_id ) {
		$product = wc_get_product( $product_id );

		if ( $product ) {
			// Only the price changes, so this does not reschedule the sale event.
			wc_apply_sale_state_for_product( $product, $this->mode );
		}

		$this->product_util->delete_product_specific_transients( $product ? $product : $product_id );
	}

	$this->release_caches( $batch_ids, $post_types );
}