WC_Discounts::get_object_subtotal()
Get the object subtotal
Method of the class: WC_Discounts{}
No Hooks.
Return
Int
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_object_subtotal();
WC_Discounts::get_object_subtotal() WC Discounts::get object subtotal code WC 9.7.1
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' ) ); } }