Methods

JS API Methods

showReserveModal()

Opens the Reserve In-Store modal so the shopper can place a new reservation.

Example: Custom button to open the reserve modal

<button onclick="ris.showReserveModal();">Show Reserve Modal</button>

Product/Variant Context

If the user is currently looking at a product the reserve modal will assume that the customer wants to reserve the current product in store.

Shopping Cart Context

If the user is currently NOT looking at a product and a shopping cart is available, the the reserve modal will assume that the customer wants to reserve their entire cart in-store.

showChooseLocationModal()

Opens the "Choose Location" modal so the shopper can choose their preferred location that the app can default to from now on.

Example: Custom link to open the choose location modal.

<a href="#" onclick="ris.showChooseLocationModal()">Choose Preferred Location</a>

on(string event, function callback)

Adds a new event listener to the system for the specified event.

Example: Trigger alert log when reserve modal is submitted

// Using the push buffer method since we don't know if RIS is loaded yet.
window.ris = window.ris || [];
window.ris.push('on', {
  event: 'reserve_modal.submit',
  callback: function() {
    alert("New reservation created!");
  }
});

See all Events at the events section for the JS API:

pageEvents

push(string method, object data)

You can call JS API methods with the push buffer if you aren't totally sure if the Reserve In-store system has loaded yet.

Example: Trigger some code upon initialization of the reserve in-store system

window.ris = window.ris || [];
window.ris.push('on', {
  event: 'init',
  callback: function() {
    alert("Reserve in store system has initialized.");
    alert("Current product variant ID is:" + ris.getVariant().id);
  }
});

getLocation(function callback)

Get the shopper's current preferred or geolocated nearest store location.

Example: Get currently preferred location

ris.getLocation(function(location) {
    console.log("Currently preferred location is: ", location);
});

getLocations(function callback)

Get all the store locations available for selection by the shopper.

Example: Get all the available store locations.

ris.getLocations(function(locations) {
    console.log("Store locations available are", locations);
});

getProduct()

Get the product that the system currently detects that the shopper is looking at.

Example: Get the current product ID

console.log("Current product ID:", ris.getProduct().id);

getVariant()

Get the product variant that the system currently has selected.

Example: Get the current variant ID

console.log("The ID of the variant currently selected is:  ", ris.getVariant().id);

Last updated