0.0.12 • Published 2 years ago

createur-cart-manager v0.0.12

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Createur Cart Library


Installation and Usage

$ npm install createur-cart-manager
import CartManager from "createur-cart-manager";

const Cart = new CartManager("databaseName")

  • Cart.push(product) - Adds new product to the cart. Updates the quantity product was previously added

const product = {
    id: "1987899424833",
    featured_image:
    "//cdn.shopify.com/link-to-image",
    title: "Compound Bow",
    price: 1900.74,
    quantity: 1
};

Cart.push(product);
  • Cart.update(productId, newQuantity) - Updates product quantity from the cart

const productId = "1987899424833";
const newQuantity = 5;

Cart.update(productId, newQuantity);
  • Cart.remove(productId) - Removes a product from the cart

Cart.remove(productId);

(Other utility methods added)

  • Cart.clear() - Removes all products from the cart

Cart.clear();
  • Cart.getTotalQuantity() - Gets the current total quantity from the cart

Cart.getTotalQuantity();

Technology and design

  • Use PouchDB for in memory database (works in the browser and in Node)

Needs improvement

  • Add ts typings
  • Add testing
  • Performance improvements
0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago