Reputation: 85
I am having trouble changing the wording within my cart page on my website. As my shop is in Australia I want to change the naming convention from Tax to GST. I have changed the language file (/wp-content/plugins/woocommerce/i18n/languages/woocommerce.pot) but it hasn't affected my shop at all.
Does anyone have another way of changing the wording within the cart page? Are there any PHP files I can edit within /wp-content/themes/mytheme/woocommerce/?
Upvotes: 3
Views: 12996
Reputation: 1063
In addition to @som answer I had to change the label / word "TAX" at checkout (changing the Tax name label in woocommerce Tax page settings, per the documentation, didn't work for some reason).
So, you can use the following translate string in your functions file (you can use this string to change multiple words as required);
/*
* =============================================================
* Text translations
*/
function 964192393_translate_woo( $translated, $untranslated, $domain ) {
if ( 'woocommerce' === $domain ) {
switch ( $translated ) {
case 'Continue Shopping':
$translated = 'Add more items';
break;
case 'Your order':
$translated = 'Order Summary';
break;
case 'Tax':
$translated = 'GST';
break;
}
}
return $translated;
}
add_filter( 'gettext', '964192393_translate_woo', 999, 3 );
Upvotes: 0
Reputation: 909
Replace “Includes $xx.xx Tax” in WooCommerce Cart and checkout page
Include the following code in your theme's functions.php file:
add_filter( 'woocommerce_cart_totals_order_total_html', 'woo_rename_tax_inc_cart', 10, 1 );
function woo_rename_tax_inc_cart( $value ) {
$value = str_ireplace( 'Tax', 'GST', $value );
return $value;
}
Upvotes: 0
Reputation: 69
Display tax totals as a single total
add_filter( 'woocommerce_countries_tax_or_vat', function () {
return __( 'GST', 'woocommerce' );
});
Another Examples
add_filter( 'woocommerce_countries_inc_tax_or_vat', function () {
return __( 'GST', 'woocommerce' );
});
add_filter( 'woocommerce_countries_ex_tax_or_vat', function () {
return __( 'GST', 'woocommerce' );
});
Upvotes: 4
Reputation: 2477
There are filters available for this. Include them in your theme's functions.php file:
/wp-content/themes/mytheme/functions.php
add_filter( 'woocommerce_countries_inc_tax_or_vat', function () {
return __( '(incl. GST)', 'woocommerce' );
});
WooCommerce 2.3.8, PHP 5.3+
See also: woocommerce_countries_tax_or_vat
& woocommerce_countries_ex_tax_or_vat
Filters and actions are used for modifying and extending core functionality (without editing anything that might be overridden by an update).
Check out the WooCommerce docs. They go to town with this kind of thing.
Upvotes: 13
Reputation: 11
Finally got the same problem sovled:
The file to amend is at "includes > class-wc-countries.php"
Upvotes: 0