Closed bkoranda closed 3 years ago
Yes, you can extend this calculation (default subtotal) with product.discount:
const myReducer = (sum, product) => (sum += (product.price * product.quantity))
total(myReducer)
@peet86 todo: add example to the readme / demo.
Thank you for this library.
Do you have an example of using a reducer function for total? I'm trying to implement applying "discount" functionality (ie: 10% off the subtotal) but not sure what the best way to implement that would be.
Thank you in advance if you are able to recommend anything.