Created
January 5, 2026 15:51
-
-
Save kennycoder/300aa46ec2f3f0eba921d0da5da7302a to your computer and use it in GitHub Desktop.
A simple script to run on the orders page of aliexpress. Calculates only the sum of visible orders, so scroll down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1. Select all the price containers | |
| const priceElements = document.querySelectorAll('.order-item-content-opt-price'); | |
| const totalPrice = Array.from(priceElements).reduce((sum, el) => { | |
| // 2. Get the combined text from all child spans (e.g., "19,46 €") | |
| let priceText = el.innerText; | |
| // 3. Clean the string: | |
| // - Replace comma with dot for calculation | |
| // - Remove the currency symbol and any non-numeric characters (except the dot) | |
| let cleanPrice = priceText.replace(',', '.').replace(/[^\d.]/g, ''); | |
| // 4. Convert to float and add to the running total | |
| return sum + (parseFloat(cleanPrice) || 0); | |
| }, 0); | |
| console.log(`The total sum is: ${totalPrice.toFixed(2)}€`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment