fix: Correctly choose the existing price ID when editing variant prices (#7894)

This commit is contained in:
Stevche Radevski authored and GitHub committed 2024-07-01 17:56:31 +02:00
1 parent d58a626d0a
commit 357621d5d6
1 file changed
+3 -2
@@ -93,7 +93,9 @@ export const PricingEdit = ({
)?.id )?.id
} else { } else {
existingId = variants[ind].prices.find( existingId = variants[ind].prices.find(
(p) => p.currency_code === currencyCode (p) =>
p.currency_code === currencyCode &&
Object.keys(p.rules ?? {}).length === 0
)?.id )?.id
} }
@@ -103,7 +105,6 @@ export const PricingEdit = ({
? { ? {
id: existingId, id: existingId,
amount, amount,
currency_code: currencyCode,
} }
: { currency_code: currencyCode, amount } : { currency_code: currencyCode, amount }