@anker-in/shopify-react 1.2.1 → 1.2.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1243,6 +1243,9 @@ function CartProvider({
1243
1243
  const filteredSameCommonAttributes = commonAttributes.filter(
1244
1244
  (attr) => !customAttributes.some((a) => a.key === attr.key)
1245
1245
  );
1246
+ const attributesNeedRemove = customAttributesNeedRemove.filter(
1247
+ ((attribute) => !customAttributes.find((a) => a.key === attribute.key))
1248
+ );
1246
1249
  const newAttributes = [
1247
1250
  ...filteredSameCommonAttributes,
1248
1251
  ...customAttributes
@@ -1250,10 +1253,13 @@ function CartProvider({
1250
1253
  const needUpdate = cart && checkAttributesUpdateNeeded(
1251
1254
  cart.customAttributes,
1252
1255
  newAttributes,
1253
- customAttributesNeedRemove
1256
+ attributesNeedRemove
1257
+ );
1258
+ const finalAttributes = newAttributes.filter(
1259
+ (attribute) => !attributesNeedRemove.find((a) => a.key === attribute.key)
1254
1260
  );
1255
1261
  if (needUpdate) {
1256
- return updateAttributes({ attributes: newAttributes });
1262
+ return updateAttributes({ attributes: finalAttributes });
1257
1263
  } else {
1258
1264
  return Promise.resolve(cart);
1259
1265
  }