WC_Customer_Download_Data_Store::delete_by_order_id
Method to delete a download permission from the database by order ID.
Method of the class: WC_Customer_Download_Data_Store{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Customer_Download_Data_Store = new WC_Customer_Download_Data_Store(); $WC_Customer_Download_Data_Store->delete_by_order_id( $id );
- $id(int) (required)
- Order ID of the downloads that will be deleted.
WC_Customer_Download_Data_Store::delete_by_order_id() WC Customer Download Data Store::delete by order id code WC 10.7.0
public function delete_by_order_id( $id ) {
global $wpdb;
// Delete related records in wc_download_log (aka ON DELETE CASCADE).
$this->delete_download_log_by_field_value( 'order_id', $id );
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
WHERE order_id = %d",
$id
)
);
}