Skip to main content

Javascript API

The MerchantPro JavaScript API provides a set of tools to simplify cart management, form customization, and dynamic UI interactions for our online shops. Designed for flexibility, it allows seamless integration of essential features with minimal effort.

Features​

Cart Actions
Manage cart operations like adding, updating, or removing items. Trigger predefined actions such as refreshing headers, showing modals, or redirecting users.

Form Errors
Display and clear custom error messages using inline text or toast notifications with simple method calls.

Event Triggers
Use data-trigger attributes for events like load, click, and visibility to bind actions dynamically.

Predefined Hooks
Automate actions on cart modifications with configurable attributes and behaviors.

Example Use Cases​

  • Add products to the cart with data-cart-add attributes or API methods.
  • Customize error handling for forms during checkout.
  • Reload specific page sections or display interactive modals/drawers for cart previews.

This API is straightforward and customizable, designed to fit a variety of e-commerce needs with minimal setup.