WC_Gateway_Paypal_Request::number_format()protectedWC 1.0

Format prices.

Method of the class: WC_Gateway_Paypal_Request{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->number_format( $price, $order );
$price(float|int) (required)
Price to format.
$order(WC_Order) (required)
Order object.

WC_Gateway_Paypal_Request::number_format() code WC 8.6.1

protected function number_format( $price, $order ) {
	$decimals = 2;

	if ( ! $this->currency_has_decimals( $order->get_currency() ) ) {
		$decimals = 0;
	}

	return number_format( $price, $decimals, '.', '' );
}