Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::delete_order_data_from_custom_order_tables()publicWC 1.0

Deletes order data from custom order tables.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$OrdersTableDataStore = new OrdersTableDataStore();
$OrdersTableDataStore->delete_order_data_from_custom_order_tables( $order_id );
$order_id(int) (обязательный)
The order ID.

Код OrdersTableDataStore::delete_order_data_from_custom_order_tables() WC 8.7.0

public function delete_order_data_from_custom_order_tables( $order_id ) {
	global $wpdb;
	$order_cache = wc_get_container()->get( OrderCache::class );

	// Delete COT-specific data.
	foreach ( $this->get_all_table_names() as $table ) {
		$wpdb->delete(
			$table,
			( self::get_orders_table_name() === $table )
				? array( 'id' => $order_id )
				: array( 'order_id' => $order_id ),
			array( '%d' )
		);
		$order_cache->remove( $order_id );
	}
}