Docs / Laravel Cart / Introduction

Introduction

A Cart Implementation for Laravel.

Supported Laravel Versions: 10, 11, and 12.

For Laravel 9.0 and below, please use version 1.0

Quick Example

// Add an item to the cart
\Cart::add(
    1, // any unique id
    'Product 1', // product name
    19.99, // product price
    2, // quantity
    ['size' => 'large'] // an array of extra attributes
);

// get the entire cart
$cartContents = \Cart::getContent();

// update an item already in the cart
\Cart::update(
    1, // the same unique id that was used to add the item
    ['quantity' => 3] // the quantity to update
);

// remove the item by its id
\Cart::remove(1);

// get the total of the cart
$total = Cart::getTotal();

// clear it all when you've finished (like when you've stored the order)
\Cart::clear();
Discovery Call

One call.
We'll both know.

20 minutes to walk through your project, ask the hard questions, and work out honestly if we're the right team for it.

  • One call per day - it gets our full attention
  • Australia's only Laravel Premier Partner
  • Senior engineers only - no juniors on your project
  • Brisbane-based, onshore team

Press Esc to close  ·  B to reopen