Ecommerce: Change "Country Taxes" text

One way is to inspect the page using Chrome Dev Tools and see if there is a unique class already on that element. I can check for you if you have a link I can use.

Hey all!

This wording comes back from Stripe or Taxjar I believe and will be based on the language set in the browser.

One of the team has written this script you can add to your page (just change “XYZ Tax” to what you want)

const translations = {
  "State Taxes": "XYZ Tax",
  "City Taxes": "XYZ Tax",
  "County Taxes": "XYZ Tax",
  "Country Taxes": "XYZ Tax",
  "Discount": "<translated>",
};

// **************************************************************** //
const extraItemsNode = document.getElementsByClassName(
  "w-commerce-commercecheckoutordersummaryextraitemslist"
)[0];

const config = {
  characterData: true,
  attributes: true,
  childList: true,
  subtree: true,
};

const callback = function (mutationsList, observer) {
  for (let mutation of mutationsList) {
    if (mutation.type !== "childList") {
      continue;
    }
    for (const addedNode of mutation.addedNodes) {
      if (!addedNode.firstChild) {
        continue;
      }
      for (const translationString in translations) {
        if (~addedNode.firstChild.innerText.indexOf(translationString)) {
          addedNode.firstChild.innerText = addedNode.firstChild.innerText.replace(translationString, translations[translationString]);
        }
      }
    }
  }
};

const observer = new WebKitMutationObserver(callback);
observer.observe(extraItemsNode, config);
1 Like

It works perfectly, thank’s ! Let’s hope they’ll fix it…
How can I indicate my delivery above my VAT in the order summary?