PHP code example of syscover / shopping-cart

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

    

syscover / shopping-cart example snippets


php artisan vendor:publish

php artisan vendor:publish --provider="Syscover\ShoppingCart\ShoppingCartServiceProvider"

foreach (CartProvider::instance()->getCartItems() as $item)
{
    $item->resetTaxRules();
}

foreach (CartProvider::instance()->getCartItems() as $item)
{
    $item->addTaxRule(new TaxRule('IVA', 18, 0, 0),);
}

foreach(CartProvider::instance()->getCartItems() as $item)
{
  $item->getQuantity();
}

CartProvider::instance()->shippingAmount = 10.00;

  CartProvider::instance()->search(function ($cartItem, $rowId) {
      return $cartItem->id === 1;
  });