JSPM

  • Created
  • Published
  • Downloads 931
  • Score
    100M100P100Q117454F
  • License BSD-3-Clause

Easy to use JavaScript SDK for managing carts and selling products from your Chec store

Package Exports

  • @chec/commerce.js

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 (@chec/commerce.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

An easy to use JavaScript SDK for building and managing carts, checkouts and receipts. Build custom eCommerce experiences to sell physical and digital products from the Chec API.

CircleCI Codecov Version Downloads/week License
commercejs.com | @commercejs | Slack

Installation

With NPM

npm install @chec/commerce.js

Documentation

See the documentation webpage.

Our documentation module source code resides in commerce.js/docs

If you would like to make contributions to the Commerce.js documentation source, here is a guide in doing so.

Upgrading

The major change in Commerce.js v2 is that most methods now return a promise that is fulfilled when the HTTP request is completed. Instead of providing callbacks to the methods in this module, you will have to use promise syntax instead.

- Commerce.Cart.retrieve(function (data) {
+ Commerce.cart.retrieve().then(function (data) {
  // ...
});

Additionally, the API for the various features are now lower-cased.

The cart.add() method now separates its arguments:

- Commerce.Cart.add({ productId: 1, quantity: 2, variant: { foo: 'bar'} })
+ Commerce.cart.add(1, 2, {foo: 'bar'})

Contributing

Check out the contributing guide

Get Help

Commerce.js is a project by many contributors. Reach us on Slack and Twitter.

Compilation

The lib files are automatically compiled by our continuous integration pipeline. You only need to commit changes to the src files.

Running the tests

You can run the unit tests for this library from your command line using npm run test, or npm run test:watch to watch for changed and re-run the tests automatically.

Code style

We use the Airbnb JavaScript style guide, and Prettier as our linting tool. To lint your code, use npm run lint or npm run lint:fix to automatically fix violations.