WC_Customer_Download_Data_Store::delete_by_download_id()publicWC 1.0

Method to delete a download permission from the database by download 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_download_id( $id );
$id(int) (required)
download_id of the downloads that will be deleted.

WC_Customer_Download_Data_Store::delete_by_download_id() code WC 8.7.0

public function delete_by_download_id( $id ) {
	global $wpdb;
	// Delete related records in wc_download_log (aka ON DELETE CASCADE).
	$this->delete_download_log_by_field_value( 'download_id', $id );

	$wpdb->query(
		$wpdb->prepare(
			"DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
			WHERE download_id = %s",
			$id
		)
	);
}