Closed redscare closed 1 year ago
Whenever any cart item quantity is changed and cart has discount code applied to it, discount amount is getting broken. The reason for that is that here https://github.com/reactioncommerce/api-plugin-discounts/blob/trunk/src/queries/getDiscountsTotalForCart.js#L26 we pass cartId to discount processor, which will fetch card from DB and calculate the discount. However, item quantity is not yet updated in DB at this moment.
Pass whole Cart object here https://github.com/reactioncommerce/api-plugin-discounts/blob/trunk/src/queries/getDiscountsTotalForCart.js#L26 instead of id
Iceboxing because this likely be removed with Promotions work
Closing this as it is a bug in the existing discount code implementation that is being deprecated
Issue Description
Whenever any cart item quantity is changed and cart has discount code applied to it, discount amount is getting broken. The reason for that is that here https://github.com/reactioncommerce/api-plugin-discounts/blob/trunk/src/queries/getDiscountsTotalForCart.js#L26 we pass cartId to discount processor, which will fetch card from DB and calculate the discount. However, item quantity is not yet updated in DB at this moment.
Steps to Reproduce
Possible Solution
Pass whole Cart object here https://github.com/reactioncommerce/api-plugin-discounts/blob/trunk/src/queries/getDiscountsTotalForCart.js#L26 instead of id
Versions