Fix API Error before M5

This commit is contained in:
Nông Đức Huy
2026-08-13 23:20:23 +07:00
parent d5cacc1208
commit 7688657d3c
13 changed files with 315 additions and 36 deletions
@@ -146,8 +146,17 @@ export function ProductForm({
translations: filled,
genderTargets: genders,
sportTypes: sports,
...(skuPrefix.trim() ? { skuPrefix: skuPrefix.trim() } : {}),
basePriceAmount: Number.parseInt(basePrice, 10) || 0,
// SKU prefix and base price are create-only fields — the inputs are not
// even rendered when editing. Sending them anyway would post
// `basePriceAmount: 0`, and the API cannot distinguish "the operator
// wants zero" from "the form always sends this", so every variant added
// by a later edit would be created free.
...(product
? {}
: {
...(skuPrefix.trim() ? { skuPrefix: skuPrefix.trim() } : {}),
basePriceAmount: Number.parseInt(basePrice, 10) || 0,
}),
options: options.map((option, index) => ({
key: option.key,
position: index,