@chiper-inc/ecommerce-lib
Version:
Chiper Inc Ecommerce Lib
38 lines (25 loc) • 463 B
Markdown
# ecommerce lib
## Features
- Type base Shop Cart
- Calculate total and subtotal of a Cart
## Installing
```bash
$ npm install ecommerce-lib
```
## Example
```js
// for v3 payload
const cart = Cart.fromShopCart(data.json);
// or for v4 payload
const cart = Cart.from(data.json);
cart.items[1].quanitty = 5;
const total = cart.getTotal();
const subtotal = cart.getSubtotal();
```
## Publish
```bash
npm install
npm run build
npm login
npm publish
```