Nano Store - Ecommerce Docs
Developer ResourcesProducts

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.

RouteBehaviour
PATCH /api/admin/products/:publicIdUpdateProductDto has no price fields. A body carrying mrp or sellingPrice is rejected by the whitelist validator
PATCH /api/admin/products/:publicId/pricingDeprecated, kept. Always returns 409 with PRODUCT_PRICING_DERIVED_FROM_VARIANTS; never writes
Variant routesThe 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 mrp and sellingPrice and shows "Prices are set on each variant." Create still sends them. The updateProductPricing fetcher was deleted.
  • Variant Name field. Each variant row has a Name input (VariantRow.tsx). Clearing it saves null, 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:
ControlPermission
Add axis, add value, Add variantProducts_CREATE
Variant inputs, gallery, Save, Activate/DeactivateProducts_UPDATE
Remove axis, remove value, delete variantProducts_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 Value row (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 sku is the default variant's SKU, then the product SKU.

See Also

  • API — deprecated /pricing route and error codes
  • Backend