WordPress at a glance
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Schemas

OrderCouponSchema::get_item_response() public WC 1.0

Convert an order coupon to an object suitable for the response.

{} It's a method of the class: OrderCouponSchema{}

No Hooks.

Return

Array.

Usage

$OrderCouponSchema = new OrderCouponSchema();
$OrderCouponSchema->get_item_response( \WC_Order_Item_Coupon $coupon );
\WC_Order_Item_Coupon $coupon (required)
-

Code of OrderCouponSchema::get_item_response() WC 5.0.0

<?php
public function get_item_response( \WC_Order_Item_Coupon $coupon ) {
	return [
		'code'   => $coupon->get_code(),
		'totals' => (object) $this->prepare_currency_response(
			[
				'total_discount'     => $this->prepare_money_response( $coupon->get_discount(), wc_get_price_decimals() ),
				'total_discount_tax' => $this->prepare_money_response( $coupon->get_discount_tax(), wc_get_price_decimals(), PHP_ROUND_HALF_DOWN ),
			]
		),
	];
}