Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::delete_order_data_from_custom_order_tables()publicWC 1.0

Deletes order data from custom order tables.

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

No Hooks.

Return

null. Nothing.

Usage

$OrdersTableDataStore = new OrdersTableDataStore();
$OrdersTableDataStore->delete_order_data_from_custom_order_tables( $order_id );
$order_id(int) (required)
The order ID.

Code of OrdersTableDataStore::delete_order_data_from_custom_order_tables() WC 7.1.0

public function delete_order_data_from_custom_order_tables( $order_id ) {
	global $wpdb;

	// 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' )
		);
	}
}