Automattic\WooCommerce\Internal\DataStores\Orders

DataSynchronizer::get_deleted_order_ids()privateWC 1.0

Get the ids of the orders that are marked as deleted in the orders meta table.

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

Хуков нет.

Возвращает

Массив. An array of order ids.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_deleted_order_ids( $deleted_from_orders_table, $limit );
$deleted_from_orders_table(true|false) (обязательный)
True to get the ids of the orders deleted from the orders table, false o get the ids of the orders deleted from the posts table.
$limit(int) (обязательный)
The maximum count of orders to return.

Код DataSynchronizer::get_deleted_order_ids() WC 9.3.3

private function get_deleted_order_ids( bool $deleted_from_orders_table, int $limit ) {
	global $wpdb;

	$deleted_from_table = $this->get_current_deletion_record_meta_value();

	$order_ids = $wpdb->get_col(
		// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
		$wpdb->prepare(
			"SELECT DISTINCT(order_id) FROM {$wpdb->prefix}wc_orders_meta WHERE meta_key=%s AND meta_value=%s LIMIT {$limit}",
			self::DELETED_RECORD_META_KEY,
			$deleted_from_table
		)
		// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
	);

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