Automattic\WooCommerce\Internal

OrderCouponDataMigrator::get_next_batch_to_process()publicWC 1.0

Returns the next batch of items that need to be processed. A batch in this context is a list of 'meta_id' values from the wp_woocommerce_order_itemmeta table.

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

Хуков нет.

Возвращает

Массив. Batch of items to process, containing $size or less items.

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

$OrderCouponDataMigrator = new OrderCouponDataMigrator();
$OrderCouponDataMigrator->get_next_batch_to_process( $size ): array;
$size(int) (обязательный)
Maximum size of the batch to be returned.

Код OrderCouponDataMigrator::get_next_batch_to_process() WC 9.7.1

public function get_next_batch_to_process( int $size ): array {
	global $wpdb;

	$meta_ids = $wpdb->get_col(
		$wpdb->prepare(
			"SELECT meta_id FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE meta_key=%s ORDER BY meta_id ASC LIMIT %d",
			'coupon_data',
			$size
		)
	);

	return array_map( 'absint', $meta_ids );
}