Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableDataStore::get_unpaid_orders_gmt
Get unpaid orders last updated before the specified GMT date.
Method of the class: OrdersTableDataStore{}
No Hooks.
Returns
Array
. Array of order IDs.
Usage
$OrdersTableDataStore = new OrdersTableDataStore(); $OrdersTableDataStore->get_unpaid_orders_gmt( $gmt_timestamp );
- $gmt_timestamp(int) (required)
- GMT timestamp.
OrdersTableDataStore::get_unpaid_orders_gmt() OrdersTableDataStore::get unpaid orders gmt code WC 9.9.5
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", OrderInternalStatus::PENDING, gmdate( 'Y-m-d H:i:s', absint( $gmt_timestamp ) ) ) ); // phpcs:enable }