Display total price (including shipping) on AliExpress item pages
< Commentaires sur AliExpress Total Price
Fixed to ensure tax is added to price before multiplying by quantity. Please disregard above.
// Enhancement: Add Tax
const taxWrap = document.querySelector("div[class*='vat-installment--wrap']");
const taxElement = document.querySelector("a[class*='vat-installment--item']");
const [tax] = taxElement?.textContent.includes('tax') ? parse(taxElement?.textContent) : [0];
...
// Add tax to price
if (price) total.textContent = `Σ ${prefix}${((price + tax) * quantity + shipping).toFixed(2)}${suffix}`;
if ((tax || shipping || quantity > 1) && !total.isConnected) {
// Insert total after tax element for clarity
taxWrap ? taxWrap.insertAdjacentElement('afterend', total) : parent.appendChild(total);
}
Thanks alot, works great. I modified it to also add the Tax (which is not included in the price in some jurisdictions, e.g. UK)
Can we get this added to the script?