Skip to main content

Inheritance

Inheritance lets a pricelist reuse its parent's prices and change only what differs. A segment pricelist can follow your base pricelist with a discount rule, and a customer pricelist can follow its segment and hold a few negotiated prices of its own. For a B2B example with a base pricelist and a customer pricelist with negotiated prices, see Customer-specific pricing.

Each pricelist has at most one parent, set with parent_code, so pricelists form a tree.


How inheritance works​

For each SKU, a pricelist either has its own price or inherits one:

  • No own price: the pricelist inherits the parent's price for the SKU, whether that is the parent's own price or one the parent inherited, and applies its own rules to it.
  • Own price: a price written on the pricelist itself always takes precedence. Inheritance never overwrites it, and from then on it is the price the pricelist's children inherit.

price.meta.inherited in a query result shows which of the two you received.

Rules build on the parent's price​

An inherited price starts from the parent's sales price, and the pricelist's rules are applied to it. In a rule, sales is the parent's price, so rules on several levels compound:

PricelistParentRuleSales price
baseNoneNone; price written with fixed: 100100
wholesalebasesales * 0.990
customer-acmewholesalesales * 0.981
customer-betawholesaleNone90

A pricelist without rules inherits its parent's price unchanged. The price is only converted when the parent uses another currency. prices.cost, prices.catalog and the other price fields remain those of the source price, on the nearest pricelist above that has its own price. A rule can therefore start again from a field, for example prices.cost * 1.25.

Inherited prices follow their source:

  • A new or changed price on the parent reaches every pricelist below it. This includes prices scheduled for a future date, which take effect on every level at the same moment.
  • Deleting a price removes the prices inherited from it.
  • A pricelist with price rules inherits only the SKUs that match one of its rules. A SKU that stops matching, for example after its article metadata changes, loses its inherited price.

When you create a pricelist with a parent, or change a pricelist's parent or rules, its inherited prices are filled in shortly afterwards. On a very large pricelist, some inherited prices can appear a little after the change is saved.

Inheriting from another currency​

A pricelist can inherit from a parent that uses another currency. The parent's price is then converted into the pricelist's currency at that currency's rate: the ECB rate with the tenant's markup. The pricelist's rules are applied to the converted price, so in a rule sales is already in the pricelist's currency. The converted price is kept to four decimal places, rounded half up, and the rounding profile then rounds it (see Exchange rates).

ParentPricelistRate used
Base currency (fx.base.currency, EUR unless set)Any otherThe pricelist currency's rate, including markup
Any otherBase currencyThe ECB rate, without markup
Any otherAny otherThe ECB rate between the two currencies, both from the same ECB day, with the pricelist currency's markup

The rate is not renewed every day. It changes only when the ECB rate moves past a threshold, the markup changes, or the base currency changes. A new rate creates new versions of the converted prices from that moment; earlier versions are unchanged. See Exchange rates.

Both currencies need an ECB rate. Creating a pricelist whose parent uses another currency, or giving a pricelist such a parent, is rejected with 400 if either currency has no ECB rate. A pricelist's currency cannot change while the pricelist exists: a write with another currency is rejected with 400. You can create a deleted pricelist again, with the same code, in another currency.

A pricelist that already inherited from another currency before conversion was introduced continues to inherit the parent's price unconverted. This lasts until its currency gets its own conversion values (PUT /fx/conversion/{currency}), the pricelist changes parent, or the pricelist is created again in another currency. From then on, its inherited prices are converted.


What is and is not inherited​

InheritedNot inherited: set on every pricelist
Prices, including quantity breaks and start datesCurrency
Bundle rules, from the nearest ancestor that has one, on a pricelist without price rules or whose price rules match the bundleVAT mode (NET or GROSS)
Metadata
Price rules

Price rules can read the parent pricelist's metadata through the parent variable; see Price rules.


Interaction with other features​

Bundles​

A pricelist uses its own bundle rule or the rule of the nearest ancestor that has one. As with other prices, a pricelist with price rules uses an ancestor's bundle rule only if one of its price rules matches the bundle; a pricelist without price rules always does. The bundle price itself is calculated on each pricelist from that pricelist's component prices. See Bundles.

Scheduled updates and history​

Inherited prices keep the start date of their source price, so scheduled changes and as_of queries work the same way on every level. See Scheduled updates and Historical pricing.


Summary​

A pricelist inherits its parent's prices for every SKU it does not price itself, and applies its own rules to them, so discounts on several levels compound. Its own prices always take precedence. A parent's price in another currency is converted at the ECB rate with markup. Currency, VAT mode, metadata and rules are set on each pricelist.