Here are the different callback functions that can be used to get the data required for different shopper experiences e.g. Add to cart functions, get a recommended size, size availability, etc.
There are 3 possible callbacks that can be used to trigger different experiences for your shoppers on both the PDP and PLP.
- newRecommendation
- inCart
- alternatives (if the size is unavailable or not produced, you can use this to re-direct or initiate another CTA)
<script type="text/javascript" async src="https://shoesize.me/assets/plugin/loader.js">
{
shopID:"SHOP_ID",
locale:"en",
zeroHash:"xxxxxxxxxx",
scale:"eu",
newRecommendation: yourRecommendationHandler,
inCart: yourAddToCartHandler,
alternatives: yourAlternativeHandler
}
</script>
// CALLBACKS HANDLERS EXAMPLE
<script>
function yourRecommendationHandler(recommendation){
console.log(recommendation);
}
function yourAddToCartHandler(recommendation){
console.log(recommendation);
}
function yourAlternativeHandler(recommendation){
console.log(recommendation);
}
</script>