Adding product to basket from recommendation block

Description

If the product recommendations block uses the add product to cart button, then each time an item is added to the cart from the recommendations block (without going to the product card page), you must call the code that tracks adding a product from the block to the cart.

🚧

Method parameters

<item_id> - The ID of the product that the user clicked on. Must match the product ID provided in the product database;

<method_name> - the name of the algorithm used to generate recommendations that were clicked on (Alternative, Related, Popular, etc.)

<suggester> - block identifier, necessary for correct calculation of statistics for each of them. A unique value must be passed to each block

Code example

<script>
rrApiOnReady.push(
    function() {
        try { 
            rrApi.recomAddToCart(<item_id>,{
                  suggester: "<%=suggesterId%>", 
                  methodName: "<%=algorithm%>"
            })
        }
        catch(e) {}
     }
);
</script>