Search code examples
wordpresswoocommerceordersformatted

How to get_formatted_order_total() if I know order_number in WooCommerce


I want to display 'Price' and 'Payment method' for a specific order with get_formatted_order_total(), all I know is order_number.

What is the best way to get this formatted order total for a specific order?


Solution

  • Since it is a public function , you can use ,

    $order = new WC_Order($order_id);
    $string = $order->get_formatted_order_total();