Commerce API
Without a build step
A script tag and a data attribute. For WordPress, Webflow and plain HTML.
Most of the internet is not a React application. If your site is WordPress, a Webflow export, a theme you are migrating, or hand-written HTML, you do not need a bundler to sell through it.
<script src="https://cdn.mercestack.com/v1/commerce.js"></script>
<script>
Mercestack.init({ publicKey: "pk_live_…" });
</script>
<button data-mercestack-buy="var_123">Buy now</button>
<button data-mercestack-add="var_123"
data-mercestack-quantity="2">Add 2 to basket</button>
<a href="/cart">Basket (<span data-mercestack-cart-count>0</span>)</a>Buttons are bound with a single delegated listener on the document, so products rendered *after* the page loads — infinite scroll, a filter that replaces the grid, a quick-view modal — work without rebinding anything.
- Buttons disable themselves while the request is in flight, so a double tap does not add two.
- Any
[data-mercestack-cart-count]element is kept in step automatically. - Failures fire a
mercestack:errorDOM event on the button rather than vanishing into an unhandled rejection.