anwar7736/shoppingcart

Make a simple shopping cart package by using laravel

dev-main 2023-06-03 15:57 UTC

This package is auto-updated.

Last update: 2024-11-03 19:08:36 UTC


README

This is a laravel simple shopping cart package. You can use this package very easily. Please follow these instructions for use this package.

Installation

composer require anwar7736/shoppingcart

Configuration

  1. Open config/app.php and add this line to your Service Providers Array.
Anwar\ShoppingCart\ShoppingCartServiceProvider::class
  1. Open config/app.php and add this line to your Aliases
'Cart' => Anwar\ShoppingCart\Facades\Cart::class
  1. Optional configuration file (useful if you plan to have full control)
php artisan vendor:publish --provider="Anwar\ShoppingCart\ShoppingCartServiceProvider"

How to use

use Anwar\ShoppingCart\Facades\Cart;

//Add single item to cart
Cart::add(id, name, quantity, price, discount(optional), variation(optional), image(optional));


//Get single item from cart
Cart::get(id);


//Update single item from cart(you can update quantity or variation or both)
Cart::update(id, quantity(optional), variation(optional));


//Remove single item from cart
Cart::remove(id);


//Get how many items in your cart
Cart::count();


//Get all cart items
Cart::content();


//Get total discount amount in your cart
Cart::discount();


//Get subtotal in your cart
Cart::subtotal();


//Remove all items from your cart
Cart::destroy();

Thank You