WC_Order::has_downloadable_item()
Returns true if the order contains a downloadable product.
Метод класса: WC_Order{}
Хуков нет.
Возвращает
true|false
.
Использование
$WC_Order = new WC_Order(); $WC_Order->has_downloadable_item();
Код WC_Order::has_downloadable_item() WC Order::has downloadable item WC 9.6.1
public function has_downloadable_item() { foreach ( $this->get_items() as $item ) { if ( $item->is_type( 'line_item' ) ) { $product = $item->get_product(); if ( $product && $product->has_file() ) { return true; } } } return false; }