Apply discount in cartTotal
AlexMonPe opened this issue · comments
Hi! I'm using useCart with NextJs.
Everything works fine, but i want to apply a discount in cartTotal, but don't know how can i override cartTotal with discount to show cartTotal with discount in all app.
Hi! I'm using useCart with NextJs.
Everything works fine, but i want to apply a discount in cartTotal, but don't know how can i override cartTotal with discount to show cartTotal with discount in all app.
You can create a state of the cartTotal as a "subTotalPrice" and another state for the "totalPrice", then deduct the discount from it, then finally show to the user the new "totalPrice".
As suggested by @hazem-saeed you can deal with this logic in your own codebase.
I was considering creating react-use-discount
but I don't use React so much these days to warrant spending time on this. Happy to collaborate if either of you want to though.