The price adjustment is controlled on the products through three custom fields. In the plugin itself you only set the rounding.
Open them in the admin under Extensions > My Extensions > Variant Price Surcharge. The configuration contains one card, "Rounding Settings". The plugin reads the values with the ID of the current sales channel, so you can set different values per sales channel.
| Setting | Key | Default | Description |
|---|---|---|---|
| Decimal Places | MmdVariantPriceSurcharge.config.roundingPrecision |
2 | Number of decimal places for the calculated price. Values are clamped to the range 0 to 10, a non-numeric value results in 2. |
| Rounding Mode | MmdVariantPriceSurcharge.config.roundingMode |
1 (HALF_UP) | Rounding method, see table |
Options of the "Rounding Mode" select, with the labels shown in the admin:
| Value | Label in the admin | PHP constant |
|---|---|---|
| 1 | Commercial round up (HALF_UP) | PHP_ROUND_HALF_UP |
| 2 | Commercial round down (HALF_DOWN) | PHP_ROUND_HALF_DOWN |
| 3 | Round to even numbers (HALF_EVEN) | PHP_ROUND_HALF_EVEN |
| 4 | Round away from zero (HALF_ODD) | PHP_ROUND_HALF_ODD |
The label of mode 4 is misleading. It maps to the PHP constant
PHP_ROUND_HALF_ODD: a value exactly on the half is rounded to the next odd number.
An unknown rounding mode value is treated like HALF_UP.
On installation the migration creates a custom field set "Variant Price Surcharge" (mmd_variant_price_surcharge) for products. You find the fields on the product in the admin, in the custom fields card.
| Technical name | Label in the admin | Type | Range | Description |
|---|---|---|---|---|
mmd_surcharge_enabled |
Enable price adjustment | Checkbox | on/off | Turns the price adjustment on |
mmd_surcharge_percentage |
Percentage of parent product | Number (float) | 0 to 1000 | 100 = full price, 50 = half price. If empty, 100 applies. |
mmd_surcharge_fixed |
Fixed price surcharge (EUR) | Number (float) | -100000 to 100000 | Amount added to (positive) or subtracted from (negative) the parent product price before the percentage is applied. If empty, 0 applies. |
The plugin ignores values outside the range and non-numeric values as if the field were empty, and writes a warning to the log. If both values are empty or invalid, the price stays unchanged even when the price adjustment is enabled.
100, and/or "Fixed price surcharge (EUR)", e.g. 8.00 or -5.00.The variant's own price is irrelevant. Only the parent product's price with surcharge and percentage counts.
Inheritance applies to the whole adjustment together, not field by field:
| State of the variant | Result |
|---|---|
| "Enable price adjustment" is not set on the variant | All three values (enabled, percentage, surcharge) come from the parent product. Percentage and surcharge stored on the variant itself are not used then. |
| "Enable price adjustment" is set on the variant (on or off) | Only the variant's values count. If the field is off, there is no adjustment even when the parent product has it enabled. |
This way you can store the adjustment once on the parent product and have it apply to all variants. To exclude a single variant, explicitly turn the field off there.
The adjustment only applies to variants, that is, products that have a parent product. A parent product itself and products without variants keep their price.
Variant price = (parent product price + fixed surcharge) x (percentage / 100)
The result is then rounded to the configured decimal places. If the calculation yields a negative value, the price is 0.00. More on the price source, taxes and currency is on Storefront and Price Calculation.
Parent product "CRM Software" at 49.00 EUR (1-user license).
| Variant | Percentage | Surcharge | Calculation | Result |
|---|---|---|---|---|
| 1 user | 100 | 0 | 49 x 1.00 | 49.00 EUR |
| 5 users | 200 | 0 | 49 x 2.00 | 98.00 EUR |
| 10 users | 350 | 0 | 49 x 3.50 | 171.50 EUR |
| Enterprise | 800 | +50 | (49 + 50) x 8.00 | 792.00 EUR |
Parent product "Pillow cover" at 12.00 EUR (standard size 40x40).
| Variant | Percentage | Surcharge | Calculation | Result |
|---|---|---|---|---|
| 40x40 standard | 100 | 0 | (12 + 0) x 1.0 | 12.00 EUR |
| 40x40 with zipper | 100 | +3 | (12 + 3) x 1.0 | 15.00 EUR |
| 50x50 | 130 | 0 | (12 + 0) x 1.3 | 15.60 EUR |
| 50x50 with zipper | 130 | +3 | (12 + 3) x 1.3 | 19.50 EUR |
Parent product "T-shirt" at 25.00 EUR.
| Variant | Percentage | Surcharge | Calculation | Result |
|---|---|---|---|---|
| Single | 100 | 0 | 25 x 1.00 | 25.00 EUR |
| 3-pack | 100 | -5 | (25 - 5) x 1.00 | 20.00 EUR |
| 5-pack | 100 | -8 | (25 - 8) x 1.00 | 17.00 EUR |