1. Go to this page and download the library: Download nhanchaukp/laracart 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/ */
nhanchaukp / laracart example snippets
use NhanChauKP\LaraCart\Facades\LaraCart;
$item = Product::find(1); // Example item
LaraCart::addItem($item, 2, 100.00, ['color' => 'red']);
$cart = LaraCart::getCart();
$items = LaraCart::getItems();
LaraCart::removeItem($item);
LaraCart::clear();
LaraCart::setDiscount(10); // 10% discount
LaraCart::assignToUser($userId);
LaraCart::driver('session');
bash
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.