laracart: Discount problems

Version: Laravel 5.5.14 + Laracart 1.3.8

Hi, I have an issue with coupons (both fixed and percentage). I have this:

PERCENTAGE Coupon

  1. Product costs € 121,00 (incl tax) € 100 (ex tax)
  2. Tax percentage is 21%
  3. When adding a discount (5%) = € 5 (subtotal should be € 95)
  4. I get this tax: € 16,00 (should be € 19,95)
  5. Total: € 111,00
LaraCart::add(1, 'Test Product', 1, 100, ['tax' => 0.21]);

$coupon = new LukePOLO\LaraCart\Coupons\Percentage('test', 0.05, [
    'name'        => '5% off',
    'description' => '5% off test',
]);

LaraCart::addCoupon($coupon);

$cart = LaraCart::get();

$cart->subTotal(false) => 100
$cart->totalDiscount(false)  => 5

$cart->taxTotal(false) => 16.00
$cart->total(false) => 111.00

FIXED Coupon

  1. Product costs € 121,00 (incl tax) € 100 (ex tax)
  2. Tax percentage is 21%
  3. When adding a discount € 30 (subtotal should be € 70)
  4. I get this tax: € -9,00 (should be € 14,70)
  5. Total: € 61.00 (should be € 84.70)
LaraCart::add(1, 'Test Product', 1, 100, ['tax' => 0.21]);

$coupon = new LukePOLO\LaraCart\Coupons\Fixed('test', 30, [
    'name'        => '30 off',
    'description' => '30 off test',
]);

LaraCart::addCoupon($coupon);

$cart = LaraCart::get();

$cart->subTotal(false) => 100.00
$cart->totalDiscount(false)  => 30.00

$cart->taxTotal(false) => -9.00
$cart->total(false) => 61.00

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

Probably, looking into this now, writing some tests