Automattic\WooCommerce\Internal\Email

OrderPriceFormatter::format_priceprivate staticWC 1.0

Helper method to format price with or without tax.

Method of the class: OrderPriceFormatter{}

No Hooks.

Returns

String. Formatted price string.

Usage

$result = OrderPriceFormatter::format_price( $order, $amount, $includes_tax ): string;
$order(WC_Abstract_Order) (required)
Order instance.
$amount(float) (required)
The amount to format.
$includes_tax(true|false) (required)
Whether to include tax in the formatted price.

OrderPriceFormatter::format_price() code WC 10.3.3

private static function format_price( WC_Abstract_Order $order, float $amount, bool $includes_tax ): string {
	return wc_price(
		$amount,
		array(
			'ex_tax_label' => ( ! $includes_tax && $order->get_prices_include_tax() ) ? 1 : 0,
			'currency'     => $order->get_currency(),
		)
	);
}