Installation
Include the Komerza client library via CDN. Add this script tag to your HTML:globalThis.komerza after the script loads.
CDN Benefits
- No build step required - Works with plain HTML/CSS/JS
- Always up-to-date - Latest version automatically delivered
- Fast loading - Cached globally via CDN
- Lightweight - Minimal impact on page load time
Initialization
Initialize the library with your store ID before using any other functions:Finding Your Store ID
Your store ID is available in your Komerza dashboard. It’s a unique identifier for your store, typically in UUID format.Example
When to Initialize
Callinit() once when your page loads, before using any other komerza methods:
✅ Good - Initialize on page load:
Framework Integration
Vanilla JavaScript
React
Vue
Svelte
Build Process
The Komerza client library works with any framework or build process-the script runs in the browser regardless of how you build your site. Use any framework:- Plain HTML/CSS/JS (no build needed)
- React, Vue, Svelte, Angular
- Next.js, Nuxt, SvelteKit, Astro
- Webpack, Vite, Rollup, Parcel
TypeScript Support
If you’re using TypeScript, you can add type definitions:Verification
Verify the library is loaded and initialized correctly:Troubleshooting
“komerza is not defined”- Make sure the script tag is loaded before your code runs
- Check browser console for script loading errors
- Verify the CDN URL is correct
- Call
komerza.init()before using other functions - Ensure init is called only once per page load
- Verify your store ID is correct (check dashboard)
- Check browser console for API errors
- Ensure you’re connected to the internet
Next Steps
Now that you’ve initialized the library, learn how to use it:Store Information
Fetch store details, logo, and banner
Products
Display and manage product listings
Basket Management
Handle shopping cart operations
Checkout
Process orders and payments