Automattic\WooCommerce\Admin\API\Reports\Products
DataStore::sync_on_order_delete
Clean products data when an order is deleted.
Method of the class: DataStore{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$result = DataStore::sync_on_order_delete( $order_id );
- $order_id(int) (required)
- Order ID.
DataStore::sync_on_order_delete() DataStore::sync on order delete code WC 10.3.6
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();
}