-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG with the PUT method on the cart items api while trying to update the metadata list prop #159
Comments
From my understanding, the issue is PUT method on the cart items API is not updating metadata values correctly for the second cart item.
Can you share the correct screenshot of the request payload sent in Step-10? |
I believe you are asking about the step-11 which was duplicated from step-10 now I updated the screenshots from step-11 simulating updating the metadata for a second variant added in the cart. So the first variant works fine with the same approach and from the second variant the issue start to happen |
Can you try passing the request payload as follows for the PUT method? {
"$set": {
"metadata": {
"sizes": []
}
}
} It is not highly recommended to pass |
I've tried this approach but the docs seems to be outdate according to this comment When trying as suggested I get a response error I believe the issue is in the api itself, we might need to get the swell api team involved as well |
Sorry, I was wrong with the request payload structure as I didn't notice that it's a frontend API. {
"metadata": {
"$set": {
"sizes": []
}
}
} I will also ensure my team to update the documentation: |
the way you're suggesting also has issues
so if you check the metadata object in the first call it returns sizes as a metadata property, but the second (update) puts the sizes inside an inner object with a key 0 When I tried to wrap the whole metadata object in the $set format than I could get it updated when adding items to the sizes array but not when removing an item, in that case the quantity changes but the sizes returns the removed index anyways. So still the api inconsistent :/ |
The swell team needs to investigate this scenario when updating an item metadata containing a list by adding and removing items from this list from multiple variants in the cart items |
I am investigating this issue and will help you with the examples of adding and removing items from the |
I can also reproduce this issue in my store and I can confirm that it is a bug. |
@danielmariz Just for your information, the way you updated You can ignore the alternate suggestions provided by me about the usage of |
Hi @logeshswell is there any plans for this fix in the short term? We're expecting on shipping to production soon so we might need to refactor on our side in order to make it work for us. Cheers! |
This issue has already been prioritized and is yet to be worked on. I don't have an ETA, but I will keep you posted if I get any updates. |
Hi team, I'm getting a weird issue while trying to update a product variant metadata but this occurs only on the second product variant added to the cart.
My scenario requires to send a custom metadata for a single variant so I'm using the PUT method to update when a client add a new option for the same variant
When adding the first product variant to the cart everything works fine:
So in resume, the same calls with different behaviour from the api, I believe that using metadata like that is not a common pattern for you so you never caught this scenario before but is a requirement from my client because they don't want to treat sizes as a variant because will be more than 30 sizes combined with other 4 variant types and will be hard to manage the product content and prices. The issue only happens after the second product variant is added to the cart although I'm managing the first item with the same calls
The text was updated successfully, but these errors were encountered: