JSPM

kisphp-cart-manager

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q18038F
  • License MIT

Simple Cart Manager

Package Exports

  • kisphp-cart-manager

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kisphp-cart-manager) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Js Cart

Simple Javascript Cart manager

Installation

npm install kisphp-cart-manager --save

Usage

var cart = Cart;

var product_1 = {
    id: 1,
    title: "Product 1",
    description: "Product description"
    // .... more product related data ....
};

id property is mandatory

quantity will be added automatically

Add product to cart

// quantity is an integer
cart.add(product_1, quantity);

subtract quantity from cart

// if quantity > available quantity in cart, then it will delete the product from cart
cart.subtract(product_1, quantity);

remove product from cart

cart.remove(product);

See Example for a demo