PHP code example of razorisuru / shopping-cart

1. Go to this page and download the library: Download razorisuru/shopping-cart library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

razorisuru / shopping-cart example snippets

bash
   $this->cart->add($userId = 1, $itemId = 101, $quantity = 2, $price = 10.50, $attributes = ['color' => 'red']);
   
bash
   $this->items = $cart->getAll($userId = 1);
   
bash
   $this->cart->remove($userId = 1, $itemId = 101);
   
bash
   $this->cart->clear($userId = 1);
   
bash
   $this->cart->total($userId = 1);
   
bash
   $this->cart->countQuantity($userId = 1);
   
bash
   $this->cart->countProducts($userId = 1);