Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::get_unpaid_orders_gmt()publicWC 1.0

Get unpaid orders last updated before the specified GMT date.

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

Хуков нет.

Возвращает

Массив. Array of order IDs.

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

$OrdersTableDataStore = new OrdersTableDataStore();
$OrdersTableDataStore->get_unpaid_orders_gmt( $gmt_timestamp );
$gmt_timestamp(int) (обязательный)
GMT timestamp.

Код OrdersTableDataStore::get_unpaid_orders_gmt() WC 9.5.1

public function get_unpaid_orders_gmt( $gmt_timestamp ) {
	global $wpdb;

	$orders_table    = self::get_orders_table_name();
	$order_types_sql = "('" . implode( "','", wc_get_order_types() ) . "')";

	// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
	return $wpdb->get_col(
		$wpdb->prepare(
			"SELECT id FROM {$orders_table} WHERE
			{$orders_table}.type IN {$order_types_sql}
			AND {$orders_table}.status = %s
			AND {$orders_table}.date_updated_gmt < %s",
			'wc-pending',
			gmdate( 'Y-m-d H:i:s', absint( $gmt_timestamp ) )
		)
	);
	// phpcs:enable
}