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
1
<button onclick="ris.showReserveModal();">Show Reserve Modal</button>
Copied!

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.
1
<a href="#" onclick="ris.showChooseLocationModal()">Choose Preferred Location</a>
Copied!

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
1
// Using the push buffer method since we don't know if RIS is loaded yet.
2
window.ris = window.ris || [];
3
window.ris.push('on', {
4
event: 'reserve_modal.submit',
5
callback: function() {
6
alert("New reservation created!");
7
}
8
});
Copied!
See all Events at the events section for the JS API:

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
1
window.ris = window.ris || [];
2
window.ris.push('on', {
3
event: 'init',
4
callback: function() {
5
alert("Reserve in store system has initialized.");
6
alert("Current product variant ID is:" + ris.getVariant().id);
7
}
8
});
Copied!

getLocation(function callback)

Get the shopper's current preferred or geolocated nearest store location.
Example: Get currently preferred location
1
ris.getLocation(function(location) {
2
console.log("Currently preferred location is: ", location);
3
});
Copied!

getLocations(function callback)

Get all the store locations available for selection by the shopper.
Example: Get all the available store locations.
1
ris.getLocations(function(locations) {
2
console.log("Store locations available are", locations);
3
});
Copied!

getProduct()

Get the product that the system currently detects that the shopper is looking at.
Example: Get the current product ID
1
console.log("Current product ID:", ris.getProduct().id);
Copied!

getVariant()

Get the product variant that the system currently has selected.
Example: Get the current variant ID
1
console.log("The ID of the variant currently selected is: ", ris.getVariant().id);
Copied!
Last modified 2yr ago