Customize the text "Total" in WooCommerce checkout page
OPTION 1 (best option)
Overriding the woocommerce checkout/review-order.php
template.
You need first (if not done) to copy the
templates
sub folder located in inwoocommerce
plugin folder to your active child theme (or theme) folde, and rename itwoocommerce
.
Once done in your active theme go to woocommerce > checkout
, and open/editreview-order.php
template file.
At the end of this template you have this:
<?php do_action( 'woocommerce_review_order_before_order_total' ); ?> <tr class="order-total"> <th><?php _e( 'Total', 'woocommerce' ); ?></th> <td><?php wc_cart_totals_order_total_html(); ?></td> </tr> <?php do_action( 'woocommerce_review_order_after_order_total' ); ?> </tfoot></table>
So you will change:
<th><?php _e( 'Total', 'woocommerce' ); ?></th>
To:
<th><?php _e( 'Total inkl. vat', 'woocommerce' ); ?></th>
Now you can save, you are done…
References:
- Template Structure + Overriding Templates via a Theme
- Woocommerce template checkout > review-order.php
OPTION 2 (Not ideal, see below)
You could use wordpress gettex()
native function for that purpose, this way:
add_filter('gettext', 'wc_renaming_checkout_total', 20, 3);function wc_renaming_checkout_total( $translated_text, $untranslated_text, $domain ) { if( !is_admin() && is_checkout ) { if( $untranslated_text == 'Total' ) $translated_text = __( 'Total inkl. vat','theme_slug_domain' ); } return $translated_text;}
This code goes in function.php file of your active child theme (or theme) or also in any plugin file.
But you will get 2 customized texts in the prices table, because there is 2
"Total"
texts (once in the first line after 'Products') and one time at the end…
This code is tested and works.