fixstacks / module-zero-unit-price
Zero for Magento Open Source: the price per kilogram, litre, metre or piece under every price, as EU price indication rules ask (per 100 g / 100 ml for small packs).
Package info
github.com/Fixstacks/module-zero-unit-price
Type:magento2-module
pkg:composer/fixstacks/module-zero-unit-price
Requires
- php: ~8.2.0||~8.3.0||~8.4.0
- fixstacks/module-zero-core: ^1.3
- magento/framework: 103.0.*
- magento/module-backend: *
- magento/module-catalog: *
- magento/module-config: *
- magento/module-eav: *
- magento/module-store: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The price per kilogram, litre, metre, square or cubic metre, or piece under every price of a product sold by quantity: "€ 7,00 (€ 9,33 / 1 l)". EU price indication rules ask for it (Directive 98/6/EC; Germany's PAngV, Austria's PrAG) wherever such goods are offered with a price.
Install
Requires Magento Open Source 2.4.7–2.4.9 and PHP 8.2–8.4 with the GD extension built with WebP (php -r 'var_dump(function_exists("imagewebp"));' says true; Magento's own PHP requirements cover the rest). Without WebP in GD, Zero skips its WebP image copies and serves the originals.
composer require fixstacks/module-zero-unit-price bin/magento setup:upgrade bin/magento setup:di:compile # production mode bin/magento setup:static-content:deploy # production mode bin/magento cache:flush
Composer installs fixstacks/module-zero-core with it.
Part of fixstacks/zero, which installs the Zero theme and every Zero module at once.
Setting it up
- Stores > Configuration > Zero > Unit Price > Enabled: Yes (off by default, per store view).
- On a product (Catalog > Products > General): Content, how much the pack holds, and Unit, what it's measured in: 750 and Millilitres for a 750 ml bottle; 3 and Pieces for a three-pack.
| Unit | Shown per |
|---|---|
| mg, g, kg | 1 kg; 100 g for packs up to 250 g (setting) |
| ml, cl, l | 1 l; 100 ml for packs up to 250 ml (setting) |
| mm, cm, m | 1 m |
| m² | 1 m² |
| m³ | 1 m³ |
| Pieces | piece |
"Hide When It Equals the Price" (on by default) shows nothing for a 1 kg pack, whose price per kilogram is its price.
Where it shows
Under the final price box, so wherever a price is: the product page, product cards in categories, search and widgets, related products. It is worked out from the price the box shows (with or without tax as the store displays prices; a configurable product's lowest), and formatted in the store's currency and locale ("€ 9,33" in de_AT, "9,33 €" in de_DE). Added after the price box's HTML, so the price box's own block cache is untouched.
Not yet: the cart and checkout lines.
License
OSL-3.0 or AFL-3.0, your choice: see NOTICE.md.
Zero is made by Fixstacks in partnership with Vilmate, a software development company. Documentation: https://fixstacks.com/zero/docs. Demo store: https://zero.fixstacks.com.