API Reference

This page documents how to manage cart operations for a UPC including opening the cart page and handling affiliate redirects.

Initialize the API

To begin using the Product Locator API, please review the prerequisites and then declare a new instance:

const lclyPlApi = new LclyPlApi_0();

Launch Cart Page

Opens the cart page with a specified UPC and store ID. If the store uses affiliate links instead of in-store pickup, it will automatically redirect the shopper.

lclyPlApi.launch_cart({{ upc }}, {{ store_id }});

Parameters:

  • upc (string): The Universal Product Code
  • storeId (number): The unique identifier for the store

Note: If a store offers an in-stock UPC as an affiliate link, the Product Locator will automatically redirect the shopper.

Features

Event Handling

The API emits events during cart operations that you can listen to for informing your shoppers or debugging purposes.

// Bind event listeners
lclyPlApi.on('cart:start', (data) => console.log('Cart started', data));
lclyPlApi.on('cart:error', (error) => console.log('Cart error', error));
lclyPlApi.on('cart:complete', (data) => console.log('Cart complete', data));

Event Reference

EventDescriptionData Payload
cart:startEmitted when cart operation beginsCart initialization data
cart:errorEmitted when an error occursError details
cart:completeEmitted when cart operation completesCart completion data