PHP code example of coercive / cart

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

    

coercive / cart example snippets




use Coercive\Shop\Cart\Cart;
use Coercive\Shop\Cart\Item;
use Coercive\Shop\Cart\Store\Session;

_ . "/dist/Ext/Address.php";

ist/Billing.php";
item, '#test123');

$item->Promo()
    ->setToken('#123456789ABCD')
    ->setPriceCut(3);

$item = (new Item)
    ->setTitle('Tutu')
    ->setPrice('\MyClass\For\Calculate\PriceItem::price')
    ->setQuantity(3)
    ->setRef(777);
$cart->Items()->addItem($item);

$cart->User()
    ->setRef(42)
    ->setLanguage('EN')
    ->setFirstName('Example FName')
    ->setLastName('Example LName')
    ->setEmail('[email protected]');

$cart->Shipping()
    ->setTitle('Example Shipping Title')
    ->setFirstName('Example FName')
    ->setLastName('Example LName')
    ->setAddress('Example Address')
    ->setZip('#12345')
    ->setTown('Example Town')
    ->setCountry('Example Country')
    ->setIsoCountry('EN');

$cart->Billing()
    ->setTitle('Example Billing Title')
    ->setFirstName('Example FName')
    ->setLastName('Example LName')
    ->setAddress('Example Address')
    ->setZip('#12345')
    ->setTown('Example Town')
    ->setCountry('Example Country')
    ->setIsoCountry('FR');


// --------------------------