Skip to content

Commit 7f858cf

Browse files
committed
feat(sync-actions): better if condition
1 parent b3204fe commit 7f858cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/sync-actions/src/product-actions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ function _buildVariantPricesAction(
261261
// Remove read-only fields
262262
const patchedPrice = price.map((p) => {
263263
const shallowClone = { ...p }
264-
if (enableDiscounted === false) delete shallowClone.discounted
264+
if (enableDiscounted !== true) delete shallowClone.discounted
265265
return shallowClone
266266
})
267267

@@ -274,11 +274,11 @@ function _buildVariantPricesAction(
274274
// Remove the discounted field and make sure that the price
275275
// still has other values, otherwise simply return
276276
const filteredPrice = { ...price }
277-
if (enableDiscounted === false) delete filteredPrice.discounted
277+
if (enableDiscounted !== true) delete filteredPrice.discounted
278278
if (Object.keys(filteredPrice).length) {
279279
// At this point price should have changed, simply pick the new one
280280
const newPrice = { ...newObj }
281-
if (enableDiscounted === false) delete newPrice.discounted
281+
if (enableDiscounted !== true) delete newPrice.discounted
282282

283283
changePriceActions.push({
284284
action: 'changePrice',

0 commit comments

Comments
 (0)