WC_Customer_Download_Data_Store::delete_by_id()publicWC 1.0

Method to delete a download permission from the database by ID.

Method of the class: WC_Customer_Download_Data_Store{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Customer_Download_Data_Store = new WC_Customer_Download_Data_Store();
$WC_Customer_Download_Data_Store->delete_by_id( $id );
$id(int) (required)
permission_id of the download to be deleted.

WC_Customer_Download_Data_Store::delete_by_id() code WC 9.4.2

public function delete_by_id( $id ) {
	global $wpdb;
	$wpdb->query(
		$wpdb->prepare(
			"DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
			WHERE permission_id = %d",
			$id
		)
	);
	// Delete related records in wc_download_log (aka ON DELETE CASCADE).
	$wpdb->query(
		$wpdb->prepare(
			"DELETE FROM {$wpdb->prefix}wc_download_log
			WHERE permission_id = %d",
			$id
		)
	);
}