Skip to content

Spacebib/cart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cart

Build Status

A Shopping Cart Abstraction

Usage

  • Setup initial state
$event = Event::init($data)
  • Create Cart
$cart = new Cart('[email protected]', $event)
  • Create Registration Form
$registration = new Registration($cart->getParticipants());

Cart API

  • Add ticket to cart
$cart->addTicket($event->getCategoryById(1), 1);
  • Get participants
$cart->getParticipants();
  • Get order details
$tickets = $cart->tickets()
$subTotal = $cart->subTotal()
$total = $cart->total()
  • Add product to cart
$cart->addProduct($product)
  • Remove product from cart
$cart->removeProduct($productId, $productVariantId)
  • Get product details
$cart->getProducts()  
  
$cart->countProducts()  
  
$cart->productsSubtotal()
  • Coupon

The cart can only use one coupon, but a coupon can be used for multiple tickets

$cart->getCoupon()
$cart->setCoupon(Coupon $coupon)
$cart->applyCoupon()
$cart->cancelCoupon()
$cart->getDiscount()
$cart->usedCouponQuantity()
  • Get currency
$cart->currency()   

Registration API

  • Render a form
$registration->renderParticipant($trackId);
  • Fill a form
$registration->fillParticipant($trackId, $data);
  • Get errors of a participant form
$registration->getErrors($trackId);
  • Redirect to next page
$registration->redirectTo();

Releases

No releases published

Packages

No packages published

Languages