Variant Pricing, Admin and Storefront Behaviour
Prices are a variant rollup; how the admin edits variants and how the storefront renders them.
Audience: Admin and storefront developers consuming the product and variant API Scope: The retired product-level pricing write, and the admin and storefront behaviour built on it. Written from shipped code in the admin and storefront repos; the backend contract is in API.
Variant Pricing, Admin and Storefront Behaviour
1. Prices are a variant rollup
A product's mrp and sellingPrice are the lowest values across its live, active variants. Nothing writes them directly.
| Route | Behaviour |
|---|---|
PATCH /api/admin/products/:publicId | UpdateProductDto has no price fields. A body carrying mrp or sellingPrice is rejected by the whitelist validator |
PATCH /api/admin/products/:publicId/pricing | Deprecated, kept. Always returns 409 with PRODUCT_PRICING_DERIVED_FROM_VARIANTS; never writes |
| Variant routes | The only place a price is edited |
2. Admin behaviour
Paths are in the admin repo under app/(dashboard)/dashboard/products/.
- Edit sends no prices. The product edit form omits
mrpandsellingPriceand shows "Prices are set on each variant." Create still sends them. TheupdateProductPricingfetcher was deleted. - Variant Name field. Each variant row has a
Nameinput (VariantRow.tsx). Clearing it savesnull, which the row displays as the product name. - Enter adds. Pressing Enter in the add-value or add-axis input adds it without a page reload. A blank Enter does nothing.
- Blocked "Add variant" names its remedy. The notice renders as visible text under the button, because a disabled button shows no tooltip:
One of the options has no values yet. Add a value to it first.Every combination of the current options already has a variant. Add another value to one of the options to create a new one.
- Permission gating per control, matching the backend
@Permissions:
| Control | Permission |
|---|---|
| Add axis, add value, Add variant | Products_CREATE |
| Variant inputs, gallery, Save, Activate/Deactivate | Products_UPDATE |
| Remove axis, remove value, delete variant | Products_DELETE |
The gates are client-side convenience; the backend enforces the same permissions.
3. Storefront behaviour
Paths are in the storefront repo under src/app/products/[slug]/.
- Single-value axes render as text rows. An axis with one value is a read-only
Name Valuerow (product-axis-text-rows.tsx), not a one-item radio group. A product with one live variant shows no radios. - Variant name and SKU line. The H1 stays the product name. A line under it shows
<variant name> · SKU <sku>for the selected variant, falling back to the product SKU. The name part is omitted when the variant has none. - Axis-less products. The variants render as a flat list, and choosing one swaps the gallery to that variant's images.
- Catalog fields now used:
- image alt text from the API instead of the product name;
- dimensions and weight shown on the product;
- the short description shown alongside the full description;
- the stock text follows the selected variant, matching the stock pill;
- OG and Twitter title, description and image from the product SEO fields;
- JSON-LD
skuis the default variant's SKU, then the product SKU.
See Also
Transactional Outbox
The enqueue rule for every future module — same-transaction outbox_events rows relayed by a dispatcher.
Product Gallery, Delete and Preview Features
Storefront gallery arrows, admin product delete with undo, the deleted-products view with restore, list filters, and the customer preview.