Check available stock in shop
Use case
I would like to check my own stock of the suggested frame size before displaying the result to the customer. If the size is out of stock I want to redirect the customer to alternative products.
If your function returns false
for the suggested size, the result screen of the widget will show a different button reading Show Alternatives.
note
For this button to work, you need to provide another callback function confirmSizeUnavailable
which decides what should happen in this scenario. You could – like in the example below – navigate to a category page in your shop, which shows other bikes in the same category.
The payload passed to your function looks like this:
note
Depending on your function you may want to change the label of the result button from Show Alternatives to something else. Here you find how you can do this.