WC_Discounts::get_object_subtotal()
Get the object subtotal
Метод класса: WC_Discounts{}
Хуков нет.
Возвращает
int
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_object_subtotal();
Код WC_Discounts::get_object_subtotal() WC Discounts::get object subtotal WC 8.7.0
protected function get_object_subtotal() { if ( is_a( $this->object, 'WC_Cart' ) ) { return wc_add_number_precision( $this->object->get_displayed_subtotal() ); } elseif ( is_a( $this->object, 'WC_Order' ) ) { $subtotal = wc_add_number_precision( $this->object->get_subtotal() ); if ( $this->object->get_prices_include_tax() ) { // Add tax to tax-exclusive subtotal. $subtotal = $subtotal + wc_add_number_precision( NumberUtil::round( $this->object->get_total_tax(), wc_get_price_decimals() ) ); } return $subtotal; } else { return array_sum( wp_list_pluck( $this->items, 'price' ) ); } }