User Tools

Site Tools


Sidebar

magento_2:price_per_unit

See the way the Price per Unit for Magento 2 extension works.

Guide for Price per Unit for Magento 2

Automatically calculate and display unit prices (base prices) for products in your Magento 2 store. Comply with the pricing requirements of your local law and help customers make fast and informed purchases.

  • Choose from 3 default units or create custom ones
  • Apply units to specific products
  • Show ‘price per unit’ blocks on product, category, and shopping cart pages
  • Customize the format of the ‘price per unit’ block display
  • WCAG Compliance (for Luma and Hyva Themes)
Magento 2 Price Per Unit extension is compatible with Hyvä themes. You can find the amasty/module-price-per-unit-hyva package for installing in composer suggest (Note: the compatibility is available as a part of an active product subscription or support subscription).

General Settings

To start configuring the extension, please navigate to Stores → Configuration → Amasty Extensions → Price per Unit → General.

Enable Price per Unit - Set to Yes to enable the extension and allow unit price display.

Please note that Magento 2 Price Per Unit extension:
  • enables the display of unit prices for simple, virtual, grouped, and downloadable products;
  • for configurable products with dynamic prices displays the same unit price for all included simple products (calculated based on the simple product with the lowest price);
  • doesn’t support bundle products;
  • takes into account special prices and catalog price rules applied to an actual selling product price when calculating the unit price.

Units Grid

You can conveniently view, manage, and create units all in one place. To access the Unit Grid, navigate to Catalog → Price per Unit → Units.

After enabling the extension, the grid includes three commonly used metrics (weight, lengths, volume) by default:

  • Grams/Kilograms;
  • Milliliters/Liters;
  • Centimeters/Meters.

You also have the flexibility to create custom metrics as needed (e.g. Pounds/Kilograms, Ounces/Pounds, Feet/Inches, Gallon/fl oz, etc.). Simply click the Add New button to create a new measurement unit or click Edit in the Action column to modify an existing one.

Create and Edit Units

After clicking the Add New button on the Units Grid, you’ll need to fill in the following settings:

Unit Name - provide the name of the future unit in a clear way to easily identify it when setting to products.

Product Unit Measure - specify the unit of measurement for the product.

Reference Unit - specify the reference unit for unit price measurement to which the price should be calculated.

Reference Amount - specify the reference amount of measurement used for calculating the price per unit.

Conversion Rate - specify the ratio of product units to the reference unit.

The decimal numbers can also be used.

Price Per Unit Text - define the format of the unit price display on product, category, and shopping cart pages.

Template that is used by default:

{{unit_price}} / {{reference_amount}} {{reference_unit}}

Feel free to combine these variables:

 {{unit_price}}, {{reference_amount}}, {{reference_unit}}, {{measure_unit}}, {{product_amount}}, {{product_price}}.

Also, you can add extra words and symbols between variables to customize the default template according to your needs.

Customized template (example):

 equals {{unit_price}} per {{reference_amount}} {{reference_unit}} 

Unit Creation Examples

To better understand the process of unit creation, we recommend checking out the examples below.

Let’s imagine that you sell:

1. ‘Whey Protein’ supplement weight of 450 Gr for $14.49 and want to indicate its price per unit (1 Kg)

In this case:

  • Product Unit Measure- Grams
  • Product Amount - 450 (for indication in the Unit Price tab on the product edit page)
  • Product Price - $14.49
  • Reference Unit - Kilograms
  • Reference Amount - 1
  • Conversion Rate - 1000 (1000 Gr = 1 Kg).

2. Vitamin B Complex 120 pills pack for $21.99 and want to indicate price per unit (1 count)

In this case:

  • Product Unit Measure - Count
  • Product Amount - 120 (for indication in the Unit Price tab on the product edit page)
  • Product Price - $21.99
  • Reference Unit - Count
  • Reference Amount - 1
  • Conversion Rate - 1

Unit Price Calculation Formula

For a unit price automatic calculation, the extension utilizes the formula: ((product_price / product_amount) * conversion_rate) * reference_amount.

Let’s plug in the values from our examples:

  • (($14.49/450 Gr)*1000)*1 = $32.20 per 1 Kg
  • (($21.99/120 Counts)*1)*1 = $0.18 per 1 Count

You can see the mentioned examples in action by visiting the extension's demo.

Assigning Units to Products

To assign units to a specific product please go to Catalog → Products and open the necessary product. Then scroll to the bottom of the edit page and expand the Unit Price tab.

Product Measuring Unit - select one of the pre-created units from the dropdown.

Product Amount - specify the amount of a particular product.

Frontend Examples

See how the unit/base price block looks on different store pages.

Product Page

Category Page

Shopping Cart Page


Find out how to install Price Per Unit for Magento 2 via Composer.

Rate the user guide
 stars  from 1 votes (Details)
magento_2/price_per_unit.txt · Last modified: 2024/02/01 07:54 by kkondrateva