Automattic\WooCommerce\StoreApi\Schemas\V1
CartFeeSchema::get_item_response
Convert a WooCommerce cart fee to an object suitable for the response.
Метод класса: CartFeeSchema{}
Хуков нет.
Возвращает
Массив.
Использование
$CartFeeSchema = new CartFeeSchema(); $CartFeeSchema->get_item_response( $fee );
- $fee(массив) (обязательный)
- Cart fee data.
Код CartFeeSchema::get_item_response() CartFeeSchema::get item response WC 10.7.0
public function get_item_response( $fee ) {
return [
'key' => $fee->id,
'name' => $this->prepare_html_response( $fee->name ),
'totals' => (object) $this->prepare_currency_response(
[
'total' => $this->prepare_money_response( $fee->total, wc_get_price_decimals() ),
'total_tax' => $this->prepare_money_response( $fee->tax, wc_get_price_decimals(), PHP_ROUND_HALF_DOWN ),
]
),
];
}