移除WooCommerce购物车税费项的(estimated for Australia)文本
Hey there! I see you're stuck with that stubborn estimated tax label cluttering up your WooCommerce cart. Let's get this sorted with filter-based solutions tailored exactly to the issue you're facing.
Why This Happens
WooCommerce automatically adds this "(estimated for [Country])" text when it can’t confirm a customer’s full address (like when they haven’t entered shipping details yet). But if you want to hide it no matter what, these filters will do the trick.
Solution 1: Strip the Estimated Text from Tax HTML
This filter targets the full HTML output of the cart tax total and removes the <small> tag containing the unwanted text. Add this code to your active theme's functions.php file (or use a custom code plugin like Code Snippets to avoid losing changes when updating your theme):
// Remove estimated tax label from cart and checkout tax totals add_filter( 'woocommerce_cart_tax_total', 'strip_estimated_tax_text', 10, 1 ); add_filter( 'woocommerce_checkout_tax_total', 'strip_estimated_tax_text', 10, 1 ); function strip_estimated_tax_text( $tax_html ) { // Regex to remove the small tag with estimated text (case-insensitive) return preg_replace( '/<small>\(estimated for.*?\)<\/small>/i', '', $tax_html ); }
Solution 2: Customize the Tax Label Directly
If the first solution doesn’t work (depending on your WooCommerce version or theme customizations), try this approach that modifies the tax label itself before it’s rendered:
// Remove estimated text from tax labels on cart/checkout add_filter( 'woocommerce_tax_label', 'customize_tax_label_remove_estimated', 10, 2 ); function customize_tax_label_remove_estimated( $label, $tax_rate ) { // Only apply this change on cart or checkout pages if ( is_cart() || is_checkout() ) { // Remove the specific estimated text and trim leftover spaces $label = trim( str_replace( '(estimated for Australia)', '', $label ) ); } return $label; }
How to Apply the Fix
- Copy either code snippet (start with Solution 1 first)
- Go to your WordPress Dashboard → Appearance → Theme File Editor
- Select your active theme, then open the
functions.phpfile - Paste the code at the very end of the file
- Click "Update File"
- Clear your site cache (and browser cache) to see the changes take effect
Both methods will remove the unwanted "(estimated for Australia)" text while keeping your tax amount intact. If one doesn’t work for your setup, give the other a shot—different themes and WooCommerce configurations can use slightly different hooks.
内容的提问来源于stack exchange,提问作者Alisha84

