WC_Product_Grouped::is_on_sale
Returns whether or not the product is on sale.
Метод класса: WC_Product_Grouped{}
Хуки из метода
Возвращает
true|false.
Использование
$WC_Product_Grouped = new WC_Product_Grouped(); $WC_Product_Grouped->is_on_sale( $context );
- $context(строка)
- What the value is for. Valid values are view and edit.
По умолчанию:'view'
Код WC_Product_Grouped::is_on_sale() WC Product Grouped::is on sale WC 10.7.0
public function is_on_sale( $context = 'view' ) {
$children = $this->get_primed_visible_children( $context );
$on_sale = false;
foreach ( $children as $child ) {
if ( $child->is_purchasable() && ! $child->has_child() && $child->is_on_sale() ) {
$on_sale = true;
break;
}
}
return 'view' === $context ? apply_filters( 'woocommerce_product_is_on_sale', $on_sale, $this ) : $on_sale;
}