WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Admin\API\Reports

Controller::get_total_formatted() public WC 1.0

Get the order total with the related currency formatting. Returns the parent order total if the order is actually a refund.

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

No Hooks.

Return

String.

Usage

$Controller = new Controller();
$Controller->get_total_formatted( $order_id );
$order_id(int) (required)
Order ID.

Code of Controller::get_total_formatted() WC 6.1.0

public function get_total_formatted( $order_id ) {
	$order = wc_get_order( $order_id );

	if ( ! $order instanceof \WC_Order && ! $order instanceof \WC_Order_Refund ) {
		return null;
	}

	if ( 'shop_order_refund' === $order->get_type() ) {
		$order = wc_get_order( $order->get_parent_id() );
	}

	return wp_strip_all_tags( html_entity_decode( $order->get_formatted_order_total() ), true );
}