23/07
2018
Shopping Cart Library
A Shopping Cart Abstraction, (*2)
$event = Event::init($data)
$cart = new Cart('xuding@spacebib.com', $event)
$registration = new Registration($cart->getParticipants());
$cart->addTicket($event->getCategoryById(1), 1);
$cart->getParticipants();
$tickets = $cart->tickets()
$subTotal = $cart->subTotal()
$total = $cart->total()
$cart->addProduct($product)
$cart->removeProduct($productId, $productVariantId)
$cart->getProducts() $cart->countProducts() $cart->productsSubtotal()
The cart can only use one coupon, but a coupon can be used for multiple tickets, (*3)
$cart->getCoupon()
```php $cart->setCoupon(Coupon $coupon), (*4)
```php $cart->applyCoupon()
```php $cart->cancelCoupon(), (*5)
```php $cart->getDiscount()
```php $cart->usedCouponQuantity(), (*6)
+ Get currency ```php $cart->currency()
$registration->renderParticipant($trackId);
$registration->fillParticipant($trackId, $data);
$registration->getErrors($trackId);
$registration->redirectTo();