phpwordpresswoocommercelabel

Hide Woocommerce Tax rate label name in front end


What a dreadful Problem. If i delete the Tax Rate Name under

.../wp-admin/admin.php?page=wc-settings&tab=tax&section=standard

and save the changes, it displays (in my case) "Mehrwertsteuer" (means Tax Rate) instead of nothing.

Any idea how to solve this issue - for example to hide the text in the frontend with css is not possible. I tried a

 

but in this case i get a space behind my text in the frontend and this looks bad. I was also not able to find a filter function. Thx in advance

enter image description here


Solution

  • You can use a custom hooked function hooked in woocommerce_rate_label filter hook this way:

    add_filter( 'woocommerce_rate_label', 'custom_tax_rate_label', 10, 2 );
    function custom_tax_rate_label( $rate_name, $key ){
        return '';
    }
    

    Code goes in function.php file of the active child theme (or active theme).

    Tested and works.

    This will remove tax label name everywhere in front end. If you wish, you can use conditional tags to hide where you need to do it.