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.
Make sure you have npm installed.
npm install @ecwid/sdk
import Ecommerce from "@ecwid/sdk";
const ecommerce = new Ecommerce({
storeId: 1002,
storeLocationPath: '/store' // optional
});
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
}
]
}
ecommerce.cart.goToCheckout();
npm run test
In future releases SDK will be able to manage:
- products and categories data;
- cart data (extended);
- customers data;
- storefront pages;
- storefront appearance.
This project is Apache2.0 licensed.