Organize your catalog with metadata
Articles in Quantaprice carry a free-form metadata
object — key/value attributes you define to match your business. Instead of
writing discount rules per SKU, you tag articles with categories, brands, and
flags, and let rules target those tags.
[
{
"sku": "LBR-2X4-8FT",
"name": "Lumber 2x4 8ft Spruce",
"metadata": {
"category": ["lumber"],
"brand": ["northwood"],
"unit": ["piece"],
"no_discount": ["false"]
}
},
{
"sku": "ELC-CBL-25-3G",
"name": "Electrical Cable 3G 2.5mm² 100m",
"metadata": {
"category": ["electrical"],
"brand": ["voltline"],
"unit": ["roll"],
"no_discount": ["false"]
}
},
{
"sku": "TLS-DRL-18V",
"name": "Cordless Drill 18V Kit",
"metadata": {
"category": ["tools"],
"brand": ["kraftwerk"],
"unit": ["kit"],
"no_discount": ["false"]
}
},
{
"sku": "SAF-HLM-PRO",
"name": "Safety Helmet Pro EN 397",
"metadata": {
"category": ["safety"],
"brand": ["guardex"],
"unit": ["piece"],
"no_discount": ["true"]
}
}
] category
drives the discount rules we'll set up shortly.
brand
gives you another dimension for rules or reporting.
no_discount
is a custom flag — the safety helmet is marked
true
to exclude it from automatic discounting. Quantaprice doesn't prescribe any
particular metadata keys; these are conventions you choose.
Metadata values are stored as lists, so even single values like
"lumber"
are wrapped in an array. This supports multi-value scenarios like
"season": ["summer", "clearance"].
Create a standard pricelist
The standard pricelist is your baseline — the full price for every product. All customer pricelists will inherit from it.
{
"code": "standard",
"name": "Standard Pricelist",
"currency_code": "SEK",
"vat_mode": "NET",
"description": "Base pricelist with full catalog pricing.",
"metadata": {
"type": ["base"]
}
} Then add fixed prices for every article:
[
{ "sku": "LBR-2X4-8FT", "prices": [{ "quantity_break": 1, "fixed": 89.00 }] },
{ "sku": "LBR-PLY-12MM", "prices": [{ "quantity_break": 1, "fixed": 345.00 }] },
{ "sku": "ELC-CBL-25-3G", "prices": [{ "quantity_break": 1, "fixed": 1250.00 }] },
{ "sku": "ELC-BRK-16A", "prices": [{ "quantity_break": 1, "fixed": 189.00 }] },
{ "sku": "TLS-DRL-18V", "prices": [{ "quantity_break": 1, "fixed": 2495.00 }] },
{ "sku": "TLS-SAW-CIRC", "prices": [{ "quantity_break": 1, "fixed": 1890.00 }] },
{ "sku": "SAF-HLM-PRO", "prices": [{ "quantity_break": 1, "fixed": 425.00 }] }
]
The NET
VAT mode means prices are stored excluding VAT; tax is calculated during
queries. The currency is SEK here, but Quantaprice supports 32+ currencies
with automatic ECB exchange rate conversion.
In the docs: The price record, VAT
Create a customer-specific pricelist
Instead of maintaining separate prices for every SKU for every customer, you create a customer pricelist that inherits from the standard list and applies discount rules on top.
{
"code": "customer-12345",
"name": "Customer Automotion Inc",
"currency_code": "SEK",
"vat_mode": "NET",
"parent_code": "standard",
"description": "Negotiated pricing for Automotion Inc.",
"metadata": {
"type": ["b2b"],
"customerId": ["12345"]
}
} -
code: "customer-12345"— a unique, predictable identifier per customer. Your e-commerce platform or ERP constructs this from the customer ID. -
parent_code: "standard"— inherits every price from the standard list. No duplication needed. -
metadata.type: ["b2b"]andmetadata.customerId: ["12345"]— tags used to find this pricelist during queries.
Because of Quantaprice's single-parent inheritance, the customer pricelist automatically includes every price from the standard list. You only define what's different.
In the docs: Pricelist inheritance
Define category discounts with price rules
Price rules are lightweight, deterministic modifiers attached to a pricelist. They run in the pricing pipeline after the base price is resolved from the inheritance chain, but before currency conversion, VAT, and rounding.
For Automotion Inc, the negotiated discounts are:
| Category | Discount |
|---|---|
| Lumber | 24% off |
| Electrical | 17% off |
| Tools | 4.5% off |
{
"price_rules": [
{
"code": "lumber-discount",
"expression": "article.metadata.category == 'lumber' && article.metadata.no_discount != 'true' ? price * 0.76 : price",
"description": "24% discount on all lumber products"
},
{
"code": "electrical-discount",
"expression": "article.metadata.category == 'electrical' && article.metadata.no_discount != 'true' ? price * 0.83 : price",
"description": "17% discount on all electrical products"
},
{
"code": "tools-discount",
"expression": "article.metadata.category == 'tools' && article.metadata.no_discount != 'true' ? price * 0.955 : price",
"description": "4.5% discount on all tools"
}
]
}
Each rule checks the article's metadata for the target category and respects
the no_discount
flag. The safety helmet, flagged as
no_discount: true,
is excluded from all three rules automatically.
Because rules target metadata rather than individual SKUs, they scale effortlessly. Add a thousand new lumber products to your catalog, and they get the 24% discount for Automotion Inc without any rule changes.
In the docs: Price rules
Query the right price
With everything configured, your e-commerce platform resolves the right price
with a single API call. The
pricelist_filter
combines a named pricelist with metadata-based selection:
{
"skus": [
"LBR-2X4-8FT",
"ELC-CBL-25-3G",
"TLS-DRL-18V",
"SAF-HLM-PRO"
],
"pricelist_filter": {
"pricelists": ["standard"],
"metadata": {
"type": ["b2b"],
"customerId": ["12345"]
}
},
"currency_code": "SEK",
"tax_area": "SE"
} pricelists: ["standard"]
includes the named standard pricelist as a baseline.
metadata
matches any pricelist tagged with both
type=b2b and
customerId=12345
— which resolves to
customer-12345.
Quantaprice evaluates both and returns the best price for each SKU.
[
{
"sku": "LBR-2X4-8FT",
"sales_price_ex_vat": 67.64,
"sales_price_inc_vat": 84.55,
"vat_rate": 0.25,
"price": { "pricelist": "customer-12345", "currency_code": "SEK" }
},
{
"sku": "ELC-CBL-25-3G",
"sales_price_ex_vat": 1037.50,
"sales_price_inc_vat": 1296.88,
"vat_rate": 0.25,
"price": { "pricelist": "customer-12345", "currency_code": "SEK" }
},
{
"sku": "TLS-DRL-18V",
"sales_price_ex_vat": 2382.73,
"sales_price_inc_vat": 2978.41,
"vat_rate": 0.25,
"price": { "pricelist": "customer-12345", "currency_code": "SEK" }
},
{
"sku": "SAF-HLM-PRO",
"sales_price_ex_vat": 425.00,
"sales_price_inc_vat": 531.25,
"vat_rate": 0.25,
"price": { "pricelist": "standard", "currency_code": "SEK" }
}
] | Product | Base price | Discount | Customer price | Pricelist |
|---|---|---|---|---|
| Lumber 2x4 Spruce | 89.00 | 24% | 67.64 | customer-12345 |
| Cable 3G 2.5mm² 100m | 1250.00 | 17% | 1037.50 | customer-12345 |
| Cordless Drill 18V Kit | 2495.00 | 4.5% | 2382.73 | customer-12345 |
| Safety Helmet Pro | 425.00 | no_discount | 425.00 | standard |
The safety helmet wasn't discounted because the
no_discount
flag excluded it from all three rules. The response shows it resolved from
standard
rather than
customer-12345.
In the docs: Authentication, Querying prices, API reference