WC_Customer_Download_Data_Store::delete_by_order_id()publicWC 1.0

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

Метод класса: WC_Customer_Download_Data_Store{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$WC_Customer_Download_Data_Store = new WC_Customer_Download_Data_Store();
$WC_Customer_Download_Data_Store->delete_by_order_id( $id );
$id(int) (обязательный)
Order ID of the downloads that will be deleted.

Код WC_Customer_Download_Data_Store::delete_by_order_id() WC 7.3.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
		)
	);
}