Automattic\WooCommerce\Gateways\PayPal
Request::get_paypal_order_purchase_unit_amount
Get the amount data for the PayPal order purchase unit field.
Метод класса: Request{}
Хуков нет.
Возвращает
array.
Использование
$Request = new Request(); $Request->get_paypal_order_purchase_unit_amount( ?WC_Order $order ): array;
- ?WC_Order $order(обязательный)
- .
Код Request::get_paypal_order_purchase_unit_amount() Request::get paypal order purchase unit amount WC 11.2.2
public function get_paypal_order_purchase_unit_amount( ?WC_Order $order ): array {
if ( ! $order ) {
return array();
}
$currency = $order->get_currency();
return array(
'currency_code' => $currency,
'value' => wc_format_decimal( $order->get_total(), wc_get_price_decimals() ),
'breakdown' => array(
'item_total' => array(
'currency_code' => $currency,
'value' => wc_format_decimal( $this->get_paypal_order_items_subtotal( $order ), wc_get_price_decimals() ),
),
'shipping' => array(
'currency_code' => $currency,
'value' => wc_format_decimal( $order->get_shipping_total(), wc_get_price_decimals() ),
),
'tax_total' => array(
'currency_code' => $currency,
'value' => wc_format_decimal( $order->get_total_tax(), wc_get_price_decimals() ),
),
'discount' => array(
'currency_code' => $currency,
'value' => wc_format_decimal( $order->get_discount_total(), wc_get_price_decimals() ),
),
),
);
}