• Resolved modkid

    (@modkid)


    Somehow the text that described how much tax is included in the total amount, upon checkout, is not translated and I can’t find it either through string translations, or through loco translate anywhere.

    I found some info about registering the field

    #: includes/class-wc-order.php:40 includes/wc-cart-functions.php:246
    msgid “(Includes %s)”
    msgstr “(Inclusief %s)”

    And generate a new MO file. It now shows up in loco, but it doesn’t seem to work.
    Anyone have any tips on how to solve the mystery to this remaining piece that isn’t translated in our shop?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support wpnomad a11n

    (@wpnomad)

    Hi there,

    You’d want to follow the solution mentioned here to translate the includes text string: https://www.ads-software.com/support/topic/override-wc_cart_totals_order_total_html-in-the-includes-directory/

    Do let us know if you have any further queries.

    Thread Starter modkid

    (@modkid)

    Unfortunately that didn’t get me much further. Not sure why it can’t be translated, polylang has the complete translation, but it’s not showing.

    • This reply was modified 4 years, 4 months ago by modkid.

    Google brought me here, I’m having the same problem as OP.
    “Includes” is not translated although language file is 100%, it appears the “includes” text string is hardcoded in wc-cart-functions.php line 320.

    Using the filter workaround in the related case Ashish linked to, I was able to replace the text. Thank you!

    This should be submitted as an issue on the bugtracker if anyone bothers.

    • This reply was modified 4 years, 4 months ago by nalleg.
    Thread Starter modkid

    (@modkid)

    Well this hardcodes another word in place, but keeps it unchanged for other languages. So it basically creates the same issue, with it not being translated. Weird though, as I remember from the past that it was able to translate..

    For anyone that sees this thread, there is another more active thread on what appears to be the same issue here.

    I have opened a bug about this on the WooCommerce GitHub repo here.

    I will leave this thread open in case this winds up being a different issue than the one from the other thread (although I expect they are the same).

    I’m going to go ahead and close this thread. Feel free to comment on the GitHub issue with any further questions or concerns.

    I just recently started using WP and came across the same issue and found threads that are years old but no one pointing out what the issue is. When you look at the file class-wc-countries.php(woocommerce), then you’ll find the hardcoded issue. There are a few functions like inc_tax_or_vat and ex_tax_or_vat. Basically there is a list of VAT countries which get VAT displayed and all other countries have hardcoded Tax.
    Changing those functions is no good as it gets removed after an upgrade of woocommerce. However, the functions reveal what text is used which can be translated. So try this:

    add_filter( 'gettext', function( $translation, $text, $domain ) {
    			if ( $domain == 'woocommerce' ) {
    				if ( $text == '(incl. tax)' ) { $translation = '(incl. GST)'; }
    				if ( $text == '(ex. tax)' ) { $translation = '(ex. GST)'; }
    				if ( $text == 'Tax' ) { $translation = 'GST'; }
    			}
    			return $translation;
    		}, 10, 3 );

    They should really fix this and build in an option to override this or use the existing setting for your tax name. There are many countries where you just have one tax to deal with and it would had been great if you could just set it.

    Hope this helps some of you.

    i have the same problem
    i fixed it for now until they release an update, you can use this

    add_filter( 'gettext', 'translate_woocommerce_vat_strings', 999, 3 );
      
    function translate_woocommerce_vat_strings( $translated, $untranslated, $domain ) {
     
       if ( ! is_admin() && 'woocommerce' === $domain ) {
     
          switch ( $translated ) {
     
             case 'VAT':
     
                $translated = 'YOUR-VAT';
                break;
           
          }
     
       }   
      
       return $translated;
     
    }
    • This reply was modified 3 years, 8 months ago by NikosTsolakos.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Translate Tax field at checkout (includes … tax)’ is closed to new replies.