VAT label translation not showing unless cart contents modified

Created on 28 March 2019, about 6 years ago
Updated 18 February 2025, about 2 months ago

When the interface language of the website changes, the Tax label in both the Cart form and Summary block doesn't show the translated term, unless you change the cart contents.

Steps to reproduce

  1. Fresh install of Commerce
  2. Enable Interface Translation
  3. Add a 2nd language (in my example, German)
  4. Add language switcher block somewhere
  5. Add currency Euro
  6. Add tax type European Union VAT
  7. Select "Display taxes of this type inclusive in product prices."
  8. Create a Store located in Germany (66787 is a valid postal code)
  9. Create a product with € Euros
  10. Add product to cart
  11. Go to the cart and you will see "VAT" under the Subtotal line
  12. Switch site language to German
  13. Notice the site interface is in German except for "VAT"
  14. Change amount of product and refresh cart
  15. "VAT" now shows as "MwSt."
  16. Switch site language to English and the problem persists
🐛 Bug report
Status

Active

Version

2.12

Component

Cart

Created by

🇩🇪Germany markdc Hamburg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇪Belgium weseze

    Ran into this issue today. So just confirming this is still an issue.

  • 🇮🇱Israel jsacksick

    Yes, not sure we can easily fix this... The adjustment label is set by order processors which are invoked on order refresh and the labels are set using the current site language. So basically the adjustment labels are in theory using the customer language.

  • 🇧🇪Belgium weseze

    For anyone needing a quickfix, this is wat I ended up using:

    /**
     * Implements hook_preprocess_HOOK().
     */
    function MODULE_preprocess_commerce_order_total_summary(&$variables) {
      if (isset($variables['totals']['adjustments'])) {
        foreach ($variables['totals']['adjustments'] as $key => $adjustment) {
          if ($adjustment['type'] === 'tax') {
            $variables['totals']['adjustments'][$key]['label'] = t('VAT');
          }
        }
      }
    
Production build 0.71.5 2024