WC_API_Orders::get_order_subtotal()
Helper method to get the order subtotal
Method of the class: WC_API_Orders{}
No Hooks.
Return
float
.
Usage
// private - for code of main (parent) class only $result = $this->get_order_subtotal( $order );
- $order(WC_Order) (required)
- -
Changelog
Since 2.1 | Introduced. |
WC_API_Orders::get_order_subtotal() WC API Orders::get order subtotal code WC 7.7.0
private function get_order_subtotal( $order ) { $subtotal = 0; // subtotal foreach ( $order->get_items() as $item ) { $subtotal += $item->get_subtotal(); } return $subtotal; }