laravel-cashier-mollie
laravel-cashier-mollie copied to clipboard
Make it possible to calculate percentage discount on subtotal
We have our own PercentageDiscountHandler and calculate the percentage based on the subtotal, because we sell B2B. Due to maintenance reasons I would like to use the PercentageDiscountHandler of this package. This change makes that possible. Thank you in advance.
Hi @DirkvanBruxvoort ,
Can you elaborate on the use case a bit? I'll also need some matching tests for a full review.
Hi @sandervanhooft,
We have the following situation:
- Someone has a scheduled order item with a unit price of 20. (ex 21% tax).
- Someone uses a 50% discount coupon. This results in an order item with a unit price of -10 if we use the subtotal. If we use the total this will result in a unit price of -12.1.
- When calculating the total for the order. The 10 euro is subtracted from the 20. This results in an order subtotal of 10. Including the tax the customer will pay 12.1 euro in total. If we would have used the total the customer would have paid 9.56 euro.
Hope this explains the use case. I know I can solve this by setting the no_tax property of the coupon to true. But then the ratio of the tax and sub total does not match what it should be.