@ecwid/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Ecwid

build npm (scoped) npm bundle size (scoped) codecov License

Ecwid Ecommerce SDK

Ecwid Ecommerce SDK allows you to add Ecwid buying experience to any platform or application: Site Builder, POS, Website, App, etc. It is a lightweight JavaScript library which does not require Ecwid widget for interacting with Ecwid API to manage online store data. It is taking on Storefront JavaScript API functions and allows you to optimize your integrations with Ecwid for performance and flexibility.

For full API documentation, visit API docs page.

Installation

NPM

Make sure you have npm installed.

npm install @ecwid/sdk

Usage

SDK initialization

import Ecommerce from "@ecwid/sdk";

const ecommerce = new Ecommerce({
	storeId: 1002,
	storeLocationPath: '/store' // optional
});

Cart operations

Get cart data in current store

const cart = ecommerce.cart.get()
	.then((result) => console.log(result))
	.catch((error) => console.error(error))

Cart model in result object:

{
    "cartId": "XXXXXXX-XXXXXX-XXXXXX-XXXX",
    "productsQuantity": 1,
    "items": [
        {
            "product": {
                "price": 99.99,
                "name": "Example",
                "id": 1000001,
                "sku": "00001"
            },
            "quantity": 1
        }
    ]
}

Navigate to checkout page with current cart data

ecommerce.cart.goToCheckout();

Development

Run tests

npm run test

Roadmap

In future releases SDK will be able to manage:

  • products and categories data;
  • cart data (extended);
  • customers data;
  • storefront pages;
  • storefront appearance.

License

This project is Apache2.0 licensed.

Keywords

Install

npm i @ecwid/sdk

DownloadsWeekly Downloads

43

Version

0.3.0

License

Apache-2.0

Unpacked Size

20.2 kB

Total Files

5

Last publish

Collaborators

  • alexis-ecwid
  • meteor-ec
  • flight-ecwid
  • ecwid-bot