PHP code example of dyankov / shopping-cart

1. Go to this page and download the library: Download dyankov/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/ */

    

dyankov / shopping-cart example snippets


$cart = Dyankov\ShoppingCart\ShoppingCart();
$cart->put($shoppingCartItem);

$cart = Dyankov\ShoppingCart\ShoppingCart();
$cart->put($shoppingCartItem);
$cart->takeOut($shoppingCartItem);

$cart = Dyankov\ShoppingCart\ShoppingCart();
$cart->put($shoppingCartItem);
$cart->total();

$cart = Dyankov\ShoppingCart\ShoppingCart();
$cart->put($shoppingCartItem);
$cart->applyCoupon($shoppingCartCoupon);