ShrinkWatch EU is an open source browser extension that shows the price per kg, litre or piece on European supermarket web shops, and warns when a pack got smaller since you last saw it. Lidl runs the same web shop software in about twenty countries, so I assumed one adapter would cover all of them. It mostly did. This post is about the two places where it did not, and what I changed in version 0.3.8.
Bug 1: the pack size moved
On lidl.de the pack size is usually in the product title. On lidl.es, lidl.it and lidl.pl it often is not. The title says "Burro di centrifuga", and the size sits in a small line under the price:
<div class="ods-price">
<div class="ods-price__value">0.89€*</div>
<div class="ods-price__footer">
<span class="block-text">125 g confezione</span>
<div>1 kg = 7.12 €</div>
</div>
</div>
The extension looked for the size in the title, structured data and labelled fields, found nothing, and showed "Pack size not found". The fix was one selector in the shop adapter:
size: '.ods-price__footer .block-text'
The existing parser already understands "125 g confezione", "75cl" and "4 x 125 g", so nothing else had to change. A page now reads €7.12 / kg (125 g), which matches the shop's own "1 kg = 7.12 €".
Bug 2: a zloty price with a euro sign
The second one was quieter. A halibut fillet on lidl.pl showed €69.90 / kg. The number was right, the currency was wrong. The price element printed just "69.90", with no sign, and the page had no structured data naming the currency, so the code fell back to its default: euro.
The fix is a per domain currency map on the adapter:
currencyByHost: { 'lidl.pl': 'PLN', 'lidl.cz': 'CZK', 'lidl.hu': 'HUF',
'lidl.ro': 'RON', 'lidl.se': 'SEK', 'lidl.dk': 'DKK' }
A currency known for the domain wins over whatever the page declares, because declared currencies are sometimes wrong too (one shop's structured data said GBP next to a euro price). The badge now reads 69.90 zł / kg (1 kg).
Tests first, then a real browser
Both fixes came with small tests built from the page markup, so they run with node --test and no browser:
test('Lidl PL: a price printed without a currency sign is still in zloty', () => {
const p = extract(lidl('Halibut filet', '69.90', '1 kg'), adapterFor('www.lidl.pl'), url);
assert.strictEqual(p.currency, 'PLN');
assert.strictEqual(badge(p), '69.90 zł / kg (1 kg)');
});
Then I checked real product pages in a normal desktop Chrome on lidl.fr, lidl.es, lidl.it, lidl.pl and lidl.nl. The other Lidl domains run the same code but are not verified yet, and the docs say so.
One known limit: when the pack size is printed only on the product photo, there is nothing in the page to read, and the badge still says "Pack size not found". I would rather show that than guess.
No requests, no tracking
The extension makes no network requests of its own. It reads the page you are already looking at, and price history stays in your browser.
- Website and install: https://emirmrkaljevic.github.io/shrinkwatch-eu/
- Source (MIT): https://github.com/emirmrkaljevic/shrinkwatch-eu
This article was written with AI assistance. The code, tests and examples come from the repo.
Top comments (0)