This package is based on Basket by philipbrown.
Require this package, with Composer, in the root directory of your project.
$ composer require faustbrian/basket
Important: Coupons are applied AFTER Discounts! This means if you have applied a Discount and a Coupon the Coupon will be applied to the discounted price.
For usage instructions check the USAGE.md.
$coupon = new Coupon('COUPON_NAME');
$coupon->add(new PercentageDiscount(20));
$coupon->add(new ValueDiscount(new Money(500, new Currency('GBP'))));
$basket->products()->first()->coupon($coupon);
$coupon->serialize();
$quantityDiscount = new PercentageDiscount(20);
$coupon->add(new QuantityDiscount(5, $quantityDiscount));
$quantityDiscount = new ValueDiscount(new Money(500, new Currency('GBP')));
$coupon->add(new QuantityDiscount(5, $quantityDiscount));
$ phpunit
If you discover a security vulnerability within this package, please send an e-mail to hello@basecode.sh. All security vulnerabilities will be promptly addressed.