@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.
@@ -1234,6 +1234,9 @@ function CartProvider({
1234
1234
  const filteredSameCommonAttributes = commonAttributes.filter(
1235
1235
  (attr) => !customAttributes.some((a) => a.key === attr.key)
1236
1236
  );
1237
+ const attributesNeedRemove = customAttributesNeedRemove.filter(
1238
+ ((attribute) => !customAttributes.find((a) => a.key === attribute.key))
1239
+ );
1237
1240
  const newAttributes = [
1238
1241
  ...filteredSameCommonAttributes,
1239
1242
  ...customAttributes
@@ -1241,10 +1244,13 @@ function CartProvider({
1241
1244
  const needUpdate = cart && checkAttributesUpdateNeeded(
1242
1245
  cart.customAttributes,
1243
1246
  newAttributes,
1244
- customAttributesNeedRemove
1247
+ attributesNeedRemove
1248
+ );
1249
+ const finalAttributes = newAttributes.filter(
1250
+ (attribute) => !attributesNeedRemove.find((a) => a.key === attribute.key)
1245
1251
  );
1246
1252
  if (needUpdate) {
1247
- return updateAttributes({ attributes: newAttributes });
1253
+ return updateAttributes({ attributes: finalAttributes });
1248
1254
  } else {
1249
1255
  return Promise.resolve(cart);
1250
1256
  }