Skip to content

Instantly share code, notes, and snippets.

@vogler
Last active November 2, 2023 14:03
Show Gist options
  • Select an option

  • Save vogler/ea7e21d67cb8a3a0c701ecb25839a4ec to your computer and use it in GitHub Desktop.

Select an option

Save vogler/ea7e21d67cb8a3a0c701ecb25839a4ec to your computer and use it in GitHub Desktop.
Tampermonkey: AliExpress: show total price incl. shipping
// ==UserScript==
// @name AliExpress: show total price incl. shipping
// @namespace https://gist.github.com/vogler
// @downloadURL https://gist.github.com/vogler/ea7e21d67cb8a3a0c701ecb25839a4ec/raw/fix-price.aliexpress.tamper.js
// @version 0.6
// @description Show the total price (item price + shipping) per item.
// @author Ralf Vogler
// @match https://www.aliexpress.com/wholesale*
// @match https://www.aliexpress.com/af/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const f = el => {
if (!el.querySelectorAll) return;
const xs = el.querySelectorAll('.product-info');
for (const x of xs) {
const title = x.querySelector('.item-title').innerText;
const price = parseFloat(x.querySelector('.price-current').innerText.match(/[0-9.,]+/)[0].replace(',', '.'));
const shipping = parseFloat((x.querySelector('.shipping-value').innerText.match(/[0-9.,]+/) || ['0'])[0].replace(',', '.'));
const total = (price + shipping).toFixed(2);
// console.log(total, shipping, title);
if (total != price) x.querySelector('.price-current').appendChild(document.createTextNode(` (${total})`));
}
}
f(document.body); // handle initially loaded items
// handle dynamically loaded items
(new MutationObserver((ms, ob) => ms.forEach(m => m.addedNodes.forEach(f)))).observe(document.body, { childList: true, subtree: true });
})();
@vogler
Copy link
Copy Markdown
Author

vogler commented Jan 18, 2021

Thanks, updated the script. (I only use USD+N26 since it's cheaper than paying in EUR directly.)

@m-git-h
Copy link
Copy Markdown

m-git-h commented Nov 2, 2023

Any updates on this?

@vogler
Copy link
Copy Markdown
Author

vogler commented Nov 2, 2023

@supak111 Haven't used AliExpress in a while.
Looks like shipping costs aren't shown in the products overview anymore, but just on the product page:
image
vs.
image

So, not much one can do (besides querying each product).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment