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

This commit is contained in:
Stevche Radevski
2024-07-01 17:56:31 +02:00
committed by GitHub
parent d58a626d0a
commit 357621d5d6

View File

@@ -93,7 +93,9 @@ export const PricingEdit = ({
)?.id
} else {
existingId = variants[ind].prices.find(
(p) => p.currency_code === currencyCode
(p) =>
p.currency_code === currencyCode &&
Object.keys(p.rules ?? {}).length === 0
)?.id
}
@@ -103,7 +105,6 @@ export const PricingEdit = ({
? {
id: existingId,
amount,
currency_code: currencyCode,
}
: { currency_code: currencyCode, amount }