Adding a product to the cart from a recommendation block
Description
If a product recommendation block uses an "add to cart" button, then every time a product is added to the cart from the recommendation block (without navigating to the product page), you must call the handler for adding a product from the block to the cart.
Method parameters
<item_id> - The ID of the product the user clicked on. Must match the product ID submitted in the product database.
<method_name> - The name of the algorithm that generated the recommendations where the click occurred (Alternative, Related, Popular, etc.).
<suggester> - The block identifier, necessary for correctly calculating statistics for each block. Each block must be passed a unique value.
Code example
<script>
rrApiOnReady.push(
function() {
try {
rrApi.recomAddToCart(<item_id>,{
suggester: "<%=suggesterId%>",
methodName: "<%=algorithm%>"
})
}
catch(e) {}
}
);
</script>