Hi I am implementing one payment gateway plugin but have a problem. It shows an error and they said it is because total amount of cart and total amount of a price website is sending for them is different. And it is because they are getting it without decimal numbers for ex. in cart it is 519.00 and they are receiving just 519.
This plugin gets cart total by $order->get_total()
function. Is there any method to make function get_total()
take order price already with .00? or if it is 519.5 to make it 519.50 and so on ?
Changing a function in their plugin might work too but I tried other like WC()->cart->total
but it shows the totals without decimals too.
WooCommerce has an inbuilt function for this
wc_format_decimal()
Usage:
wc_format_decimal( $order->get_total(), 2 );
//or
wc_format_decimal(WC()->cart->total, 2 );
Hope this helps!