Automattic\WooCommerce\StoreApi\Schemas\V1
OrderItemSchema::get_totals()
Get totals data.
Method of the class: OrderItemSchema{}
No Hooks.
Return
Array
.
Usage
$OrderItemSchema = new OrderItemSchema(); $OrderItemSchema->get_totals( $order_item );
- $order_item(\WC_Order_Item_Product) (required)
- Order item instance.
OrderItemSchema::get_totals() OrderItemSchema::get totals code WC 9.3.1
public function get_totals( $order_item ) { return [ 'line_subtotal' => $this->prepare_money_response( $order_item->get_subtotal(), wc_get_price_decimals() ), 'line_subtotal_tax' => $this->prepare_money_response( $order_item->get_subtotal_tax(), wc_get_price_decimals() ), 'line_total' => $this->prepare_money_response( $order_item->get_total(), wc_get_price_decimals() ), 'line_total_tax' => $this->prepare_money_response( $order_item->get_total_tax(), wc_get_price_decimals() ), ]; }