npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@chec/commerce.js

v2.8.0

Published

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

Downloads

2,010

Readme

Installation

With NPM

npm install @chec/commerce.js or yarn add @chec/commerce.js

TypeScript

You may also install our TypeScript definitions:

npm install @types/chec__commerce.js or yarn add @types/chec__commerce.js

Note that when using TypeScript, the definitions are always compliant with our latest version of the API. If you specify a custom API version, or your API key uses an older version, you may get type errors.

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.

Configuration

The following configuration options are available to be defined as the third argument in the Commerce constructor:

  • disableStorage: Whether to disable persistent storage (e.g. cookies). Enable for use in server-side environments. Default: false.
  • cartLifetime: Number of days that a cart should be stored for (between 1 and 30). Default: 30.
  • timeoutMs: The number of milliseconds before a request will time out. Default: 60000.
  • axiosConfig: An optional object containing configuration options for axios, if used.
    • headers: A list of request headers. Defining headers here will override the defaults.
  • allowSecretKey: Commerce.js will prevent you from using a secret API key for authorization. Use this option to override. Default: false.

Upgrading

Upgrading to 2.4.0

Commerce.js 2.4.0 only supports API version 2021-03-31 when adding products to a cart with variants. Please consider updating your API version, using the changes listed in the API docs as a guide.

Upgrading to 2.0.0

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.