@ecwid/sdk
v0.8.0
Published
Lightweight SDK library to access Ecwid API functions.
Downloads
15,750
Readme
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.