Streaming live at 10am (PST)

New BUG in eCommerce- Translation of Discount

Hi i have found what i think is a new BUG. I added the new discount function for one of me clients (new port from Shopify to Webflow)

We did have problem with the translation of Country Tax simce before and now i have the same problem with the translation of the wording Discount. Have i missed something??

OrderSum

@WebDev_Brandon @johnramos

Hi @JanneWassberg

The option to change the ‘country tax’ text is currently not available natively within Webflow.

We do have a bit of custom code that can be added to the project to change the “Country Taxes” text. The code is as follows:

`const translations = {
“State Taxes”: “Doofenshmirtz Tax”,
“City Taxes”: “Doofenshmirtz Tax”,
“County Taxes”: “Doofenshmirtz Tax”,
“Country Taxes”: “Doofenshmirtz Tax”,
};

// **************************************************************** //
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 taxType in translations) {
if (~addedNode.firstChild.innerText.indexOf(taxType)) {
addedNode.firstChild.innerText = translations[taxType];
}
}
}
}
};
const observer = new WebKitMutationObserver(callback);
observer.observe(extraItemsNode, config);
`
**** Make sure you place this in a opening and closing script tags.

You can replace the text “Doofenshmirtz Tax” with what you would like to be displayed instead of “Country Taxes.”

You would also do this with the Discount one too.

Custom code is available on Webflow sites that have site plans (hosting) or projects in a paid account plan.

Please refer to the following articles for how to include custom code on Webflow sites:

Please let me know if you have any other questions,

~ Happy Designing ~
Brandon