🏠 返回首頁 

AliExpress Total Price

Display total price (including shipping) on AliExpress item pages

< Commentaires sur AliExpress Total Price

Avis: Bon - le script fonctionne correctement

§
Posté le: 22/03/2025
Édité le: 22/03/2025

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?

  // 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 total
if (price) total.textContent = `Σ ${prefix}${(price * quantity + shipping + tax).toFixed(2)}${suffix}`;
if ((shipping || quantity > 1) && !total.isConnected) {
// Insert total after tax element for clarity
taxWrap ? taxWrap.insertAdjacentElement('afterend', total) : parent.appendChild(total);
}
§
Posté le: 22/03/2025
Édité le: 22/03/2025

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);
}

Poster une réponse

Connectez-vous pour poster une réponse.