Greasy Fork

AliExpress Total Price

Display total price (including shipping) on AliExpress item pages

< 脚本AliExpress Total Price的反馈

评价:好评 - 脚本运行良好

§
发表于:2025-03-22
编辑于:2025-03-22

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);
  }
§
发表于:2025-03-22
编辑于:2025-03-22

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

发表回复

登录以发表回复。