# Unit price and sale by weight: DataFirefly Unit Price documentation

> Installation Install the module from Modules > Module Manager > Upload a module with the ZIP file. The same ZIP covers PrestaShop 1.7.8, 8 and 9. The module creates four…

- Page: <https://www.datafirefly.com/en/documentation/dfunitprice/>
- Language: en
- Last updated: 2026-11-18
- Other languages: [fr](https://www.datafirefly.com/documentation/dfunitprice/index.md), [es](https://www.datafirefly.com/es/documentation/dfunitprice/index.md), [de](https://www.datafirefly.com/de/documentation/dfunitprice/index.md), [it](https://www.datafirefly.com/it/documentation/dfunitprice/index.md), [pl](https://www.datafirefly.com/pl/documentation/dfunitprice/index.md), [nl](https://www.datafirefly.com/nl/documentation/dfunitprice/index.md), [pt](https://www.datafirefly.com/pt/documentation/dfunitprice/index.md)
- Index: <https://www.datafirefly.com/en/documentation/llms.txt>

## Installation

Install the module from **Modules > Module Manager > Upload a module** with the ZIP file. The same ZIP covers PrestaShop 1.7.8, 8 and 9.

The module creates four tables (net contents, sale modes, weighings, change history) and adds the **Catalog > Unit prices** screen. The **Configure** button of the module manager opens the same screen.

From version 1.x, the update keeps the net contents, sale modes, settings and weighing history.

![Module overview: coverage of the mandatory categories, products with a unit price, orders to weigh](https://www.datafirefly.com/wp-content/uploads/2026/11/unit-prices-overview-dfunitprice-en.webp)

## Setup assistant

On first display, the assistant asks for your sales countries. For each country whose official text has been read, a note summarises the reference units and cites the text (Directive 98/6/EC, the French orders of 1987 and 1999, the German PAngV, the Spanish, Italian, Dutch and Polish texts). These notes are a starting point, not legal advice: you remain responsible for the prices you display.

- 1 kg and 1 l are always recommended. 100 g and 100 ml are only offered if all the chosen countries allow them.
- Germany is added to the **strict countries**: a German visitor always sees a price per 1 kg or 1 l.
- The last step chooses the display style. The assistant remains available from the button at the top of the screen.

![Setup assistant: sales countries and reference units, with the official texts cited](https://www.datafirefly.com/wp-content/uploads/2026/11/setup-assistant-sales-countries-dfunitprice-en.webp)

## Overview

The **Overview** tab shows the coverage of the categories where the unit price is mandatory, the number of products with a unit price, those sold by weight or at actual weight, the orders to weigh and the native unit prices to resynchronise.

The **To fix** list shows the active products of these categories without net content. When a net content can be read in the name (“100 g”), the **Use 100 g** button saves it in one click.

## Entering net contents

### Products tab: bulk editing

Filter by category, by name, reference or ID, and by status (without unit price, with unit price, missing in mandatory categories). Enter the net content and the unit: the unit price is calculated as you type and the line is ticked. A net content read in the name is shown below the field (**Use 250 g**). **Save the selected lines** saves up to 500 products at once, optionally with the combinations whose name contains a net content.

![Bulk editing of net contents with the unit price computed live and detected contents](https://www.datafirefly.com/wp-content/uploads/2026/11/bulk-edit-net-contents-dfunitprice-en.webp)

### Detection tab: preview before saving

The module reads net contents in names, references and combination names: 250 g, 75 cl, 6 x 33 cl (198 cl), 1.5 kg, 2.5 m, 2.2 m², box of 6. Dimensions such as “160 x 230 cm” are ignored. The shipping weight can be used as a hint (it often includes the packaging). Each proposal shows its source and its reliability; only reliable proposals are ticked in advance. Nothing is saved before you confirm.

![Detection of net contents in names and combinations, with a preview before saving](https://www.datafirefly.com/wp-content/uploads/2026/11/net-content-detection-preview-dfunitprice-en.webp)

### Product page

**Modules** tab of the product page, **Unit price and sale mode** block, with its own save button:

- **Net content** and **Unit**: g, kg, ml, cl, l, mm, cm, m, m², m³ or piece.
- **Unit price expressed per**: 1 kg or 100 g, 1 l or 100 ml, per piece or per dozen. Overrides the module setting for this product (except for visitors from strict countries).
- **Front preview**: how the unit price looks with the chosen style.
- **Combinations**: each combination has its own unit price. **Fill from the combination names** reads “500 g” in “Size - 500 g”.

![Back office product page: net content, front preview and unit price of each combination](https://www.datafirefly.com/wp-content/uploads/2026/11/product-page-unit-price-dfunitprice-en.webp)

## The calculation

The unit price is the price actually shown to the customer divided by the net content, brought back to the chosen reference. It follows specific prices, promotions, catalog price rules, the customer group (tax incl. or excl.), the currency and the quantity discount when the customer changes the quantity. It is rounded to the precision of the currency, according to the rounding mode of the shop. A zero price gives no unit price.

The module also keeps the native PrestaShop unit price up to date (amount, “/ kg” label, impact per combination) for the feed, comparison and quick view modules that read it. If you disable the module, this native price is shown again on its own.

## Settings

### Display

- **Style**: discreet, pill, highlighted or framed, with preview.
- **Format**: “€27.60 / kg”, “(€27.60 / kg)” or “€27.60 per kg”. Optional **Text before the unit price**, per language.
- Display on the product page, in product lists (categories, search, carousels) and in the cart.
- **Hide the native unit price where this module shows its own**: hiding only affects the price blocks that contain the module’s unit price. A product without net content keeps its native unit price.
- **Hide when equal to the selling price** (1 kg pack sold per kg).
- **Positions in the theme**: change these only if your theme does not call the default positions of the `displayProductPriceBlock` hook.

![Display settings: four unit price styles with preview, format and positions](https://www.datafirefly.com/wp-content/uploads/2026/11/unit-price-display-styles-dfunitprice-en.webp)

### Reference units

Weights per 1 kg or 100 g, volumes per 1 l or 100 ml. Lengths are expressed per metre, surfaces per m², bulk volumes per m³. **Countries always shown per 1 kg / 1 l**: ISO codes separated by commas (`DE` by default).

### Categories where a unit price is mandatory

Subcategories included. They feed the coverage and the “To fix” list.

### Advanced

**Write the unit price into the native PrestaShop fields** (enabled by default) and **schema.org UnitPriceSpecification structured data** on the product page (disabled by default). Search engines read this data as they see fit: no display is guaranteed.

## Sale by customer-chosen weight

**Customer chooses the quantity** mode on the product page. The net content becomes the size of one step and the product price the price of one step: with a 100 g step at €0.45, a customer who chooses 1 kg adds 10 steps for €4.50.

- **Minimum**, **maximum** (optional) and **preset buttons** (`500; 1000; 2000`), multiples of the step.
- **Allow a free quantity**: +/- selector with direct entry, rounded to the step.

On the product page, the selector replaces the theme’s quantity field, shows the total and the stock in kilos, hides the native “minimal quantity 2” message and follows the modules that change the quantity (quantity tiers). The maximum is enforced server side. The order line becomes “Rice (1 kg)” in the back office, on the invoice and in the confirmation email.

![Sale by weight: weight chosen with buttons or free entry, total and stock in kilograms](https://www.datafirefly.com/wp-content/uploads/2026/11/sale-by-weight-selector-dfunitprice-en.webp)

Stock is still counted in steps, because PrestaShop does not handle decimal quantities. With a 100 g step, enter 50 for 5 kg. The block on the product page reminds you of this conversion.

## Piece at actual weight

**Piece at actual weight** mode for meat, cheese cut to order or fish. The net content is the average weight of a piece, the price that of a piece of this weight. The range (lightest piece, heaviest piece) is optional.

The product page shows a “Sold at actual weight” box with the rules that follow from your settings. The order line becomes “Tomme (about 1.2 kg)” or “(2 × about 1.2 kg)”.

![Piece at actual weight: estimated weight, range and adjustment rules shown to the customer](https://www.datafirefly.com/wp-content/uploads/2026/11/piece-at-actual-weight-dfunitprice-en.webp)

### Policy for heavier pieces

The module never charges the customer. Three policies, announced on the product page, on the invoice and in the email:

- **Offered** (default): a heavier piece costs nothing extra.
- **Supplement with agreement**: a capped supplement (10% by default) is recorded as “awaiting” and the customer is informed by email. You collect it yourself, only if they accept (payment link, payment provider), then mark it as “collected” or “offered”.
- **Announced margin (authorisation)**: the product page announces the maximum supplement. Some payment methods let you authorise this amount and capture less: this depends on your payment provider, the module captures nothing.

**Tolerance**: below this difference (in %), neither refund nor supplement. **Minimum refund**: below this amount (tax incl.) on the order, no credit slip is created.

![Pieces at actual weight: policy for heavier pieces, cap, tolerance and minimum refund](https://www.datafirefly.com/wp-content/uploads/2026/11/actual-weight-policy-dfunitprice-en.webp)

### Weighing an order

On the order page, the **Actual weight** block lists the lines concerned with the amount paid and the estimated weight.

1. Enter the actual total weight of each line: `1.15` (kg), `1150 g` or `1.15 kg`. **Enter** moves to the next line.
2. The difference (in %) and the amount (refund or supplement) are calculated as you type. A weight more than ten times the estimate is flagged (probable unit error).
3. **Preview the email** shows the message the customer will receive, in their language.
4. **Save the weights**: the weighing is final. A double validation (double click, two employees) never creates a second credit slip.

![Weighing on the order: quick entry of the actual weight, difference and amount computed live](https://www.datafirefly.com/wp-content/uploads/2026/11/order-weighing-difference-dfunitprice-en.webp)

![Preview of the email sent to the customer with the actual weight and the refund](https://www.datafirefly.com/wp-content/uploads/2026/11/actual-weight-email-preview-dfunitprice-en.webp)

What is created: a **PrestaShop credit slip** (VAT broken down, “Adjustment to the actual weight” table in the PDF), a **voucher** of the same amount if you tick the box, the **email** to the customer and a **private note** on the order. Refunded or restocked quantities are not changed: no stock is put back on sale. The customer sees the actual weights in their order details.

The credit slip records the refund but does not refund the money: unless you give a voucher, pay back the amount with your payment provider. A cancelled or refunded order can no longer be weighed.

The **Weighing** tab lists the orders to weigh (oldest first) and the last weighings, with their refund and the status of the supplement.

## CSV import and export

The export produces one line per product and per combination of the shop, for the whole catalog or one category. Columns: `id_product`, `id_product_attribute`, `reference`, `name`, `net_quantity`, `unit`, `reference_unit`. Cells that begin with `=`, `+`, `-` or `@` are neutralised against spreadsheet formulas.

The import is done in two steps: **Preview** lists the lines to save, to clear, unchanged and in error, then you confirm. File up to 5 MB, separator `;`, `,` or tab, UTF-8 or Windows-1252. Units: g, kg, ml, cl, l, mm, cm, m, m2, m3, unit (accepted aliases: gr, kilo, litre, pcs…). `reference_unit`: 1kg, 100g, 1l, 100ml, 1unit, 12unit. An empty `net_quantity` clears the line.

![Two-step CSV import: preview of the lines to save, to clear and in error](https://www.datafirefly.com/wp-content/uploads/2026/11/csv-import-preview-dfunitprice-en.webp)

## History and undo

Each bulk edit, detection, import or save from the product page forms a batch in the **History** tab. **Undo** restores the net contents to their previous state. A line changed since then is left as it is and flagged.

![History of net content changes with one-click undo](https://www.datafirefly.com/wp-content/uploads/2026/11/change-history-undo-dfunitprice-en.webp)

## Permissions and multistore

- A profile with the **View** permission on the Unit prices tab can see everything, without changing anything. Saves, weighings, imports and undos require the **Edit** permission.
- In multistore, lists, imports, undos and weighings are limited to the products and orders of the shops in your context. Settings follow the PrestaShop shop context. Net contents are shared by all shops (they are product data).

## Troubleshooting

### The unit price does not appear on the product page

Check the product’s net content and the display on the product page. If your theme does not call the `after_price` position, choose `price` or `weight` in **Positions in the theme**.

### The unit price appears twice

Enable hiding of the native unit price. Hiding uses the CSS selector `:has()`, supported by current browsers; an old browser shows both prices, never none.

### The native unit price is out of date after a price import

**Import / export** tab, **Resynchronise the products out of date**. The price shown by the module is always calculated from the current price.

### The quantity field stays visible on a product sold by weight

The theme uses non-standard quantity markup. The minimum and maximum are still enforced server side. Contact us with the name of the theme.

## Compatibility

- PrestaShop 1.7.8, 8 and 9 (tested on 1.7.8.11, 8.2.1 and 9.1.5), PHP 7.2 to 8.5, Classic and Hummingbird themes.
- Display through the native `displayProductPriceBlock` hook, without override.
- Interface, front office and emails in French, English, Spanish, German, Italian, Portuguese, Polish and Dutch.
- This module helps you display unit prices. You remain responsible for the prices you display and for checking the rules of your countries.
