Automattic\WooCommerce\StoreApi\Schemas\V1
OrderItemSchema::get_totals
Get totals data.
Метод класса: OrderItemSchema{}
Хуков нет.
Возвращает
Массив.
Использование
$OrderItemSchema = new OrderItemSchema(); $OrderItemSchema->get_totals( $order_item );
- $order_item(WC_Order_Item_Product) (обязательный)
- Order item instance.
Код OrderItemSchema::get_totals() OrderItemSchema::get totals WC 10.5.0
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() ),
];
}