Pack and Unit Pricing for Magento 2
- Compatibility
- 2.4.9
- Hyvä theme
- Hyvä compatible
- AI management (MCP)
- No
Description / Pack and Unit Pricing for Magento 2
MAGENTO 2 · PACKAGING · UNIT PRICES
Package and per-item prices. Clear for your customers.
Sales Units and Price Conversion
Do you sell by the carton while customers compare the price of a single item? Do you offer rolls, metres, kilograms or pallets? The Sales Units and Price Conversion module shows the relationship between units and a secondary price calculated from the current Magento price. Customers can compare your offer more easily and understand which unit they are buying.
18 units · 4 display modes · Luma and Hyvä
HOW IT WORKS IN PRACTICE
PLN 96 per package
PLN 8 per item
If a package contains 12 items and costs PLN 96, the module also shows PLN 8 per item. You can highlight the package price, the unit price or both. When the catalog price is per package, a quantity of 1 still means one package, even when PLN 8 per item is displayed as the main price. The example amounts use the same tax context.
1 package = 12 items
Purchase quantity: 1 package.
Match the price display to the way you sell
Show buyers which unit the price refers to and how much the other unit costs. Choose a layout for the store view and override it for an individual product when needed.
Four display modes
- Units only: the native price with its unit, plus the unit beside the quantity field, without conversion.
- Package price as the main price: the other unit’s price in the details under the information icon.
- Unit price as the main price: the package price in the details under the information icon.
- Both prices visible: the catalog price, the unit relationship and the secondary price without a tooltip.
Set the mode per store view. Individual products can have their own setting. For relationships such as kilogram–gram, the tooltip keeps the catalog price as the main price without treating either unit as packaging.
Units and product configuration
The module provides 18 units: item, module, package, carton, pallet, set, pair, roll, hour, day, metre, square metre, cubic metre, litre, millilitre, kilogram, gram and tonne. For each product, configure the price and quantity unit, units A and B, a positive factor, the price basis, conversion enablement and, optionally, the display mode.
Installation creates default labels in English. Unit labels can be translated per store view; a Polish interface translation is included. Existing translations and product values are preserved.
Display in the storefront
- Product pages, category listings and search results.
- Page Builder: product lists and grids, sliders and carousels.
- Related products and upsells with separate switches.
- Optional catalog units in supported cart, cart item editing, mini-cart and order summary areas.
The Luma and Hyvä adapters share the same data and conversion engine. Prices come from Magento’s numeric price model, including changes to special prices or tier price thresholds. The module does not extract amounts from HTML text or maintain its own exchange rates.
Quantity and full-package rules
One native Magento quantity unit corresponds to the catalog price unit. The module does not change the ordered quantity, transaction price or stock levels. Below the quantity field, it shows the catalog unit without quantity conversion or a tooltip.
If the catalog price is per item and the display is to include a package of 12, compatible native Magento rules are required: stock management, enabled quantity increments, and the correct minimum and increment. For example, a minimum of 12 and an increment of 12 allow package conversion to be displayed. With a minimum of 1 and increments disabled, the module displays units only. Configure inventory settings in Magento; the module does not write them.
From configuration to the result
01 · Define the units
Set the price and quantity unit, units A and B, and the catalog price basis.
02 · Add the factor
For example: one package contains 12 items. Enable conversion for the product.
03 · Choose the display mode
Show the secondary price in a tooltip or display both prices side by side.
The purchase quantity stays clear
When the catalog price is per package, a quantity of 1 means one package. This also applies when the converted per-item price is shown as the main price.
If the catalog price is per item, full-package ordering must follow Magento’s native minimum quantity and quantity increment settings.
Installation and maintenance
Composer package: kowal/module-unit-pricing. Includes the core Kowal_UnitPricing module and the Kowal_UnitPricingHyva adapter. Requires PHP with the bcmath extension. The module’s storefront display, Hyvä gateway and optional cart areas are disabled by default. After installation, configure the products and enable the relevant areas in the selected store view.
Compatibility and supported products
The module was tested on Magento 2.4.9, PHP 8.3.36, Hyvä 1.5.3 and Page Builder 2.2.7, with the Luma and Hyvä adapters.
Conversion covers simple and virtual products without custom options. Configurable, grouped and bundle products, MSRP and custom types retain their native flow, with no declared conversion support. There is no direct Hyvä Checkout adapter; a custom checkout may require an additional integration point.
Adapt sales units to your store
Ask about implementing the Sales Units module and discuss the units, quantity rules and theme used in your store.
More Information
| Purchase information |
Before deployment, establish the catalog price unit, quantity rules and theme compatibility. Hyvä adapter included; no direct integration with Hyvä Checkout. |
|---|---|
| Hyvä theme | Hyvä compatible |
| Theme compatibility | Hyvä, Luma / Blank, KOWAL |
Questions and Answers
Does showing a unit price change order quantities or stock levels?
Can I show both the pack price and the price per item?
Does unit pricing work with Luma, Hyvä and Page Builder?
Which Magento product types support unit price conversion?
Why does my Magento product show a unit label without a converted price?
Which sales units can I use, and can I translate their labels?
Does the unit price update when a special price or tier price applies?
Does the unit price appear in Hyvä Checkout or a custom checkout?
How do I install the sales units extension for Magento 2?
How do I enable unit pricing for selected products or store views?
Change Log
0.1.0 — module features
- Four price display modes and per-product overrides.
- Catalog unit below the quantity field; no quantity conversion or quantity tooltips.
- Minimum and increment checks when converting prices in another unit to package prices.
- Bulk reading of Magento quantity rules.
Other features
- Luma and Hyvä adapters, Page Builder, related products and upsells.
- Tooltips supporting focus, click and Escape.
- Tooltips kept within the viewport and moved outside clipping containers.
- Dictionary of 18 units, validation and diagnostics.
Integration Configuration
The module does not require an external API or an account with an additional service. It uses Magento’s prices, taxes, currencies and quantity rules.
Luma has its own price-box adapter, while Hyvä uses the included Alpine adapter. A custom cart or checkout may need an integration based on the cart item ID. There is no direct Hyvä Checkout adapter.
Required PHP extension: bcmath. Tested environment: Magento 2.4.9 / PHP 8.3.36 / Hyvä 1.5.3 / Page Builder 2.2.7.
Store-view configuration
Go to Stores → Configuration → Catalog → Sales Units and Price Conversion. Enable display for the selected view, then set the mode and areas. Enable the Hyvä gateway only in views using Hyvä. Enable the cart and order summary separately after checking the integration.
Product example: a package of 12 items
- In the Sales Units group, set the price and quantity unit to package.
- Unit A: package. Unit B: item. Factor: 12. Catalog price basis: A.
- Enable conversion. Set the actual package price in Magento’s native fields.
- Choose a mode or inherit it from the store configuration. At PLN 96 per package, the secondary price is PLN 8 per item, and quantity 1 means one package.
When the catalog price is per item
The price and quantity unit must then be item, with the corresponding price basis. For 1 package = 12 items, configure compatible native minimum and increment rules, for example a minimum of 12 and an increment of 12, with stock management and quantity increments enabled. The module checks these rules but does not configure them.
Translations and configuration checks
Translate unit labels for the store views you use. Check the product page, category, search, Page Builder, related products and upsells, price changes, tier price thresholds and correct taxes. Confirm that order quantities and amounts remain consistent with native sales. Any attribute set created after installation must include the module’s eight fields; add them if missing.
Module Installation Instructions
Installation with Composer
Run the commands from the Magento root directory. Before installation, make a backup and check the module in a test environment.
1. Add the Kowal Composer repository
composer config repositories.kowal composer https://repo.kowal.store2. Configure repository access
After purchase, you will receive your access credentials, the customer email address and license token, by email. They are also available in your customer account after signing in to kowal.store. Replace TWOJ_EMAIL_KLIENTA with your account email address and TWOJ_TOKEN with the token you received.
composer config http-basic.repo.kowal.store "TWOJ_EMAIL_KLIENTA" "TWOJ_TOKEN"3. Install the module with Composer
composer require kowal/module-unit-pricingThis command installs the module from the Kowal Composer repository.
4. Enable the module
php bin/magento module:enable Kowal_UnitPricingIf your store uses Hyvä, use the following command instead to also enable the adapter included in the same package:
php bin/magento module:enable Kowal_UnitPricing Kowal_UnitPricingHyva5. Apply database updates
php bin/magento setup:upgradeIf your deployment process preserves previously built generated files, you can use the --keep-generated option. This option does not replace the required compilation or asset build.
6. Prepare production assets
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy pl_PL en_USAdjust the locale list to your store. For Hyvä, also include the asset build process for the theme in use. Follow your store’s production deployment procedure, using maintenance mode or a prepared release.
7. Refresh indexes and cache
php bin/magento indexer:reindex
php bin/magento cache:clean8. Check the installation and unit dictionaries
php bin/magento module:status Kowal_UnitPricing
php bin/magento unitpricing:checkThe diagnostic command only reads data. Store-view settings, product units and examples are available in the module configuration tab.