Automattic\WooCommerce\Admin\API\Reports\Products

DataStore::sync_on_order_delete()public staticWC 1.0

Clean products data when an order is deleted.

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

Хуки из метода

Возвращает

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

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

$result = DataStore::sync_on_order_delete( $order_id );
$order_id(int) (обязательный)
Order ID.

Код DataStore::sync_on_order_delete() WC 9.4.2

public static function sync_on_order_delete( $order_id ) {
	global $wpdb;

	$wpdb->delete( self::get_db_table_name(), array( 'order_id' => $order_id ) );

	/**
	 * Fires when product's reports are removed from database.
	 *
	 * @param int $product_id Product ID.
	 * @param int $order_id   Order ID.
	 */
	do_action( 'woocommerce_analytics_delete_product', 0, $order_id );

	ReportsCache::invalidate();
}