laravel-cashier-mollie icon indicating copy to clipboard operation
laravel-cashier-mollie copied to clipboard

Make it possible to calculate percentage discount on subtotal

Open DirkvanBruxvoort opened this issue 2 years ago • 2 comments

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.

DirkvanBruxvoort avatar Aug 30 '22 14:08 DirkvanBruxvoort

Hi @DirkvanBruxvoort ,

Can you elaborate on the use case a bit? I'll also need some matching tests for a full review.

sandervanhooft avatar Sep 01 '22 10:09 sandervanhooft

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.

DirkvanBruxvoort avatar Sep 10 '22 12:09 DirkvanBruxvoort