Hi @yangjingjing,
There are different ways to change “Tax” to “GST” in WooCommerce. Even if you’ve updated the tax settings, WooCommerce might still be using default wording from its templates.
Here are a few methods you can try:
- Name the tax class to GST. In most instances this will reflect depending on how the theme you have is developed.
- Language Customization: Use the Loco Translate plugin to find and replace the text.
- Template Override: Edit WooCommerce template files in your theme, such as
email-order-details.php
for emails or order-receipt.php
for invoices.
- Custom Code: Use a
gettext
filter in your theme’s functions.php
file to dynamically replace the text.
Here’s an example code snippet:
add_filter('woocommerce_get_order_item_totals', function ($total_rows, $order) {
if (!empty($total_rows)) {
foreach ($total_rows as $key => $row) {
if (stripos($row['label'], 'tax') !== false) {
$total_rows[$key]['label'] = str_ireplace('tax', 'GST', $row['label']);
}
}
}
return $total_rows;
}, 10, 2);
If this code doesn’t work, try the other two methods or consult a WooCommerce expert, as your setup might need a tailored solution.