@shoppexio/storefront
v0.3.1
Published
Official JavaScript storefront SDK for Shoppex
Maintainers
Readme
@shoppexio/storefront
Official JavaScript storefront SDK for Shoppex.
Use this package when you want to embed Shoppex products, cart behavior, and hosted checkout into a custom frontend.
Good fit
Use this package for:
- product loading
- cart state
- checkout redirects
- storefront helpers
Install
npm install @shoppexio/storefrontQuick start
import shoppex from '@shoppexio/storefront';
shoppex.init('my-store');
const products = await shoppex.getProducts();
shoppex.addToCart(products.data?.[0]?.uniqid ?? '', 'default', 1);
await shoppex.checkout();Coupon validation
Use the options form when validating a coupon for a selected product variant:
const result = await shoppex.validateCoupon('SAVE10', {
productId: 'prod_abc123',
variantId: 'variant_lifetime',
});Calling validateCoupon(code) without options validates against the current SDK cart. Affiliate/referral codes are separate and should use validateAffiliateCode or applyAffiliateCode. If program_enabled is false in an affiliate validation response, the shop-level affiliate program is disabled even if individual links exist.
Not this package
If you want the authenticated Developer API wrapper for backend integrations, use @shoppexio/sdk. Do not ship @shoppexio/sdk in a browser bundle; use this Storefront SDK for headless storefronts.
Docs
- Storefront docs: docs.shoppex.io/sdk/introduction
- Installation: docs.shoppex.io/sdk/installation
