-
Notifications
You must be signed in to change notification settings - Fork 73
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
Discount disappears from GetCartTotals query after updating quantity of items in cart using the UpdateItemQuantity button #2426
Comments
Is this Magento's fault? Is Magento removing te coupon or is GraphCommerce incorrectly removing the coupon? (There is some discussion here, not sure if it is related: #2381) |
It's not a coupon it's a discount that's being applied to an item if a certain quantity is added to cart if that helps. I should mention I've tried using the same query and mutation inside Postman (without the @Injectable and @Inject decorators obviously) and the query returns the discount when the condition is met even after running the mutation, but in my application that has decorators it doesn't, so the problem definitely derives from the decorators. Once i removed the CartItemCountChanged string from the @Inject(into: ["CartItemCountChanged", "PaymentMethodUpdated"]) array inside the CartTotals fragment it worked. My guess is once I run the updateCartItems mutation in the UpdateItemQuantity.graphql file it's spreading CartItemCountChanged in the results which is affecting what CartTotals returns once it runs in the CartTotals.tsx file because of the @Inject decorator i mentioned in the previous paragraph. I also forgot to mention I'm also using an earlier version of Graphcommerce (8.0.6) if that helps as well. I created this issue because I don't know what might break if I remove the CartItemCountChanged string from the @Inject into array I checked out the issue you linked and it isn't related to mine sadly |
@UrosJeknic Do you see a console warning where Apollo Client is mentioning data loss? |
Nope. It's not logging anything to the console |
Can we reproduce it on the demo?
Am I missing something in my steps? The demo is running 8.0.8, but those releases should not contain anything related to that: 8.0.8 and 8.0.7 |
I can't reproduce it in the demo. I patched a couple of node modules files so maybe there's a line of code i changed that may be causing this issue, but I don't remember changing anything that could. I'll take a look. Thanks for the help |
Hope you get it resolved on your side :) |
Describe the Bug
After updating quantity using the UpdateItemQuantity button it mutates the discounts property from cart.prices
Expected Behavior
It shouldn't mutate the discount unless the condition isn't being met anymore.
I'm guessing the CartItemCountChanged fragment that's being injected into in the CartTotals fragment is causing the bug because after removing the decorators from the CartTotals.graphql file the discounts only disappear after a condition isn't being met anymore (e.g 4 same items in cart)
To Reproduce
Be sure to have an item that has a [conditional] discount in your cart. Go to /cart. Click on the UpdateItemQuantity button to change the quantity of one of your items. After doing that the discount should disappear regardless if it's condition is being met or not.
The text was updated successfully, but these errors were encountered: