wc_cart_totals_order_total_html

Get order total html including inc tax if needed.

Description

wc_cart_totals_order_total_html(); 

Usage

  1. if ( !function_exists( 'wc_cart_totals_order_total_html' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-cart-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wc_cart_totals_order_total_html(); 
  7.  

Defined (1)

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

/includes/wc-cart-functions.php  
  1. function wc_cart_totals_order_total_html() { 
  2. $value = '<strong>' . WC()->cart->get_total() . '</strong> '; 
  3.  
  4. // If prices are tax inclusive, show taxes here 
  5. if ( wc_tax_enabled() && WC()->cart->tax_display_cart == 'incl' ) { 
  6. $tax_string_array = array(); 
  7.  
  8. if ( get_option( 'woocommerce_tax_total_display' ) == 'itemized' ) { 
  9. foreach ( WC()->cart->get_tax_totals() as $code => $tax ) 
  10. $tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label ); 
  11. } else { 
  12. $tax_string_array[] = sprintf( '%s %s', wc_price( WC()->cart->get_taxes_total( true, true ) ), WC()->countries->tax_or_vat() ); 
  13.  
  14. if ( ! empty( $tax_string_array ) ) { 
  15. $taxable_address = WC()->customer->get_taxable_address(); 
  16. $estimated_text = WC()->customer->is_customer_outside_base() && ! WC()->customer->has_calculated_shipping() 
  17. ? sprintf( ' ' . __( 'estimated for %s', woocommerce ), WC()->countries->estimated_for_prefix( $taxable_address[0] ) . WC()->countries->countries[ $taxable_address[0] ] ) 
  18. : ''; 
  19. $value .= '<small class="includes_tax">' . sprintf( __( '(includes %s)', woocommerce ), implode( ', ', $tax_string_array ) . $estimated_text ) . '</small>'; 
  20.  
  21. echo apply_filters( 'woocommerce_cart_totals_order_total_html', $value );