Skip to main content

Check available stock in shop

info

The checkIsAvailable callback triggers a custom function that is used to check the stock of the desired ski. If stock information is provided to the widget and the ski is out of stock it will display a sold out message. You can then setup an additional custom function for the confirmSizeUnavailable callback to specify what happens after closing the widget.

If your function to check your stock returns false for the suggested size, the result screen of the widget will show a different button reading Continue shopping.

Confirm Size Unavailable Screen

important

For this button to work, you need to provide another callback function confirmSizeUnavailable which decides what should happen in this scenario.

const myCheckStockFunction = (payload) => {
const { code, displaySize01, type } = payload;
let sizeAvailable = false;

// here goes YOUR code that will check the stock for recommended ski…
// … and return `true` if in stock or `false` if not
// use the payload to identify the recommended ski in your shop that you need to check the stock for
return sizeAvailable;
};

const OZ_CONFIG = {
settings: {
// config options here
},
events: {
checkIsAvailable: {
callback: myCheckStockFunction,
},
},
};
caution

We explicitely recommend that you use the product code passed in the payload to your function to query the stock for the desired variant. Passed size information is not consistent and should not be used as an identifier.