Automattic\WooCommerce\Admin\API\Reports\Coupons
DataStore::sync_on_order_delete()
Clean coupons data when an order is deleted.
Method of the class: DataStore{}
Hooks from the method
Return
null
. Nothing.
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 7.3.0
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 coupon's reports are removed from database. * * @param int $coupon_id Coupon ID. * @param int $order_id Order ID. */ do_action( 'woocommerce_analytics_delete_coupon', 0, $order_id ); ReportsCache::invalidate(); }