WC_Order_Item_Product_Data_Store::get_download_ids()publicWC 3.0.0

Get a list of download IDs for a specific item from an order.

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

Хуков нет.

Возвращает

Массив.

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

$WC_Order_Item_Product_Data_Store = new WC_Order_Item_Product_Data_Store();
$WC_Order_Item_Product_Data_Store->get_download_ids( $item, $order );
$item(WC_Order_Item_Product) (обязательный)
Product order item object.
$order(WC_Order) (обязательный)
Order object.

Список изменений

С версии 3.0.0 Введена.

Код WC_Order_Item_Product_Data_Store::get_download_ids() WC 8.7.0

public function get_download_ids( $item, $order ) {
	global $wpdb;
	return $wpdb->get_col(
		$wpdb->prepare(
			"SELECT download_id FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE user_email = %s AND order_key = %s AND product_id = %d ORDER BY permission_id",
			$order->get_billing_email(),
			$order->get_order_key(),
			$item->get_variation_id() ? $item->get_variation_id() : $item->get_product_id()
		)
	);
}