From 357621d5d62cc701bc466a341e37383c840edc2c Mon Sep 17 00:00:00 2001 From: Stevche Radevski Date: Mon, 1 Jul 2024 17:56:31 +0200 Subject: [PATCH] fix: Correctly choose the existing price ID when editing variant prices (#7894) --- .../src/routes/products/product-prices/pricing-edit.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/admin-next/dashboard/src/routes/products/product-prices/pricing-edit.tsx b/packages/admin-next/dashboard/src/routes/products/product-prices/pricing-edit.tsx index 0f64a9d914..fb4f4aca73 100644 --- a/packages/admin-next/dashboard/src/routes/products/product-prices/pricing-edit.tsx +++ b/packages/admin-next/dashboard/src/routes/products/product-prices/pricing-edit.tsx @@ -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 }