woocommerce_get_formatted_order_total

Filter WooCommerce formatted order total.

Description

apply_filters( 'woocommerce_get_formatted_order_total', (number) $formatted_total, (WC_Order) $instance, (string) $tax_display, (bool) $display_refunded ); 

Parameters (4)

0. $formatted_total (number)
The formatted total.
1. $instance (WC_Order)
The instance.
2. $tax_display (string)
Type of tax display.
3. $display_refunded (bool)
If should include refunded value.

Usage

To run the hook, copy the example below.
  1. $formatted_total = apply_filters( 'woocommerce_get_formatted_order_total', $formatted_total, $instance, $tax_display, $display_refunded ); 
  2.  
  3. if ( !empty( $formatted_total ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_get_formatted_order_total callback 
  2. function filter_woocommerce_get_formatted_order_total( $formatted_total, $instance, $tax_display, $display_refunded ) { 
  3. // make filter magic happen here... 
  4. return $formatted_total
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_get_formatted_order_total', 'filter_woocommerce_get_formatted_order_total', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_get_formatted_order_total', 'filter_woocommerce_get_formatted_order_total', 10, 4 ); 

Defined (2)

The filter is defined in the following location(s).

/includes/class-wc-order.php  
  1. return apply_filters( 'woocommerce_get_formatted_order_total', $formatted_total, $this, $tax_display, $display_refunded ); 
/includes/abstracts/abstract-wc-order.php  
  1. return apply_filters( 'woocommerce_get_formatted_order_total', $formatted_total, $this );