Margins Validator
Validates that no line items in the cart are sold below cost price.
Overview
The Margins Validator checks that the effective price per unit for each line item is not lower than the product's cost price. If a line item is being sold at a loss, the validator returns an error for that line, preventing the cart from becoming an order until the pricing is corrected.
Identifier
| Property | Value |
|---|---|
| Connector ID | marginsValidator |
| Validation Type | Price |
| Validation Scope | LineItem |
Behavior
- For each line item, calculates the effective price per unit:
ExtendedPrice / Quantity - Compares the result against the line item's
Cost - If the price per unit is lower than the cost, the line item is flagged
- Returns one validation error per affected line item, including the SKU code
- If no line items have negative margins, validation passes
Error messages
| Condition | Translation Key |
|---|---|
| Price per unit is below cost | MarginsValidationError |
Configuration
No additional properties required.
