Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableDataStore::order_exists()
Check if an order exists by id.
Метод класса: OrdersTableDataStore{}
Хуков нет.
Возвращает
true|false
. True if an order exists with the given name.
Использование
$OrdersTableDataStore = new OrdersTableDataStore(); $OrdersTableDataStore->order_exists( $order_id ): bool;
- $order_id(int) (обязательный)
- The order id to check.
Список изменений
С версии 8.0.0 | Введена. |
Код OrdersTableDataStore::order_exists() OrdersTableDataStore::order exists WC 9.5.1
public function order_exists( $order_id ): bool { global $wpdb; // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared $exists = $wpdb->get_var( $wpdb->prepare( "SELECT EXISTS (SELECT id FROM {$this->orders_table_name} WHERE id=%d)", $order_id ) ); // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared return (bool) $exists; }