Frontend

JavaScript SDK & Headless

Get started To explore more about the SparkLayer JavaScript SDK, please refer to our SparkLayer JavaScript SDK documentation.

Introduction

With the SparkLayer JavaScript SDK, you can enhance your frontend development and create more customised experiences for your users. The SDK provides a range of straightforward functions to access data stored within SparkLayer, as well as granting access to the GraphQL API and a cart update function.

Document image


Example use-cases

The SparkLayer SDK empower developers to build more advanced and dynamic applications on top of the SparkLayer platform. Use-cases can include:

Functionality

Description

Accessing Data and APIs

Provides functions to access data within SparkLayer and utilize the GraphQL API, enabling the development of advanced and dynamic applications.

Manual Initialization

Allows manual initialization of the SDK, useful in headless commerce implementations

Customizing User Experiences

Allows calculation of pricing data, updating the shopping cart and retrieving updated cart information, customisation of the look and feel

Product Variant Image Updating

Custom code can be added to update product images when a variant is selected, enhancing user shopping experience by providing visual feedback.

Custom Checkout Validation

Enables custom validation logic at checkout for personalized API calls to verify cart contents and manage checkout permissions based on custom rules (e.g., managing one-time discounts, product quota limits).

Adding Custom Attributes to Cart Items

Offers a method to include custom attributes with cart items, ensuring customizations are visible under the product SKU and persist through to past orders.

Explore more

To explore more about the SparkLayer JavaScript SDK, please refer to our SparkLayer JavaScript SDK documentation.

Please note If you're looking to extend your SparkLayer integration by using the SDK, we do strongly recommend speaking to our technical team to ensure it can meet your requirements. Please contact us here



Headless implementations (Composable Commerce)

SparkLayer has been designed and built to be a fully headless (composable) eCommerce platform and there are a variety of ways it can be extended. To learn more, please see our headless guide for what's possible.