Socket
Socket
Sign inDemoInstall

@ecomplus/shopping-cart

Package Overview
Dependencies
3
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ecomplus/shopping-cart

Simple vanilla JS library to handle shopping cart object and events


Version published
Weekly downloads
464
increased by81.25%
Maintainers
1
Install size
2.47 MB
Created
Weekly downloads
 

Changelog

Source

2.6.0 (2023-11-26)

Features

  • check global ECOM_CART_STORAGE_KEY to optionally change default key (771ad6e)

Readme

Source

Shopping Cart

Publish CodeFactor npm version license mit

Simple vanilla JS library to handle shopping cart with common methods following E-Com Plus cart object model

CHANGELOG

Usage

The @ecomplus/shopping-cart package can be used to persist and treat shopping cart data on E-Com Plus stores (and not only).

It's available for both Node.js and browser environments.

Example

import ecomCart from '@ecomplus/shopping-cart'

ecomCart.on('change', ({ data }) => {
  console.log('Cart was changed!')
  console.log('Current cart data:', data)
})

ecomCart.addItem({
  _id: '12300000000000000000000f',
  product_id: '123a5432109876543210cdef',
  sku: 's-MP_2B4',
  name: 'Mens Pique Polo Shirt',
  quantity: 4,
  price: 42.9,
  keep_item_price: false
})

ecomCart.increaseItemQnt('12300000000000000000000f', 3)

Installation

It may require and doesn't include core-js (optional) and @ecomplus/utils (peer dependency).

Webpack
npm i --save core-js @ecomplus/utils @ecomplus/shopping-cart
Node.js
npm i --save @ecomplus/utils @ecomplus/shopping-cart
CDN
<script src="https://cdn.jsdelivr.net/npm/@ecomplus/shopping-cart/dist/ecom-cart.var.min.js"></script>

When importing from CDN, EventEmitter3 and ecomUtils libraries must be included separately and available on window scope.

Keywords

FAQs

Last updated on 26 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc