Automattic\WooCommerce\StoreApi\Schemas\V1
OrderItemSchema::get_totals
Get totals data.
Метод класса: OrderItemSchema{}
Хуков нет.
Возвращает
array.
Использование
$OrderItemSchema = new OrderItemSchema(); $OrderItemSchema->get_totals( $order_item );
- $order_item(WC_Order_Item_Product) (обязательный)
- Order item instance.
Код OrderItemSchema::get_totals() OrderItemSchema::get totals WC 11.2.2
public function get_totals( $order_item ) {
$price_decimals = wc_get_price_decimals();
return [
'line_subtotal' => $this->prepare_money_response( $order_item->get_subtotal(), $price_decimals ),
'line_subtotal_tax' => $this->prepare_money_response( $order_item->get_subtotal_tax(), $price_decimals ),
'line_total' => $this->prepare_money_response( $order_item->get_total(), $price_decimals ),
'line_total_tax' => $this->prepare_money_response( $order_item->get_total_tax(), $price_decimals ),
];
}