Impulse purchase products

With this endpoint, you can retrieve the 'Impulse purchase products', also called 'Cross sell products', via JavaScript. You can use this on the cart page for webshops that use the Afosto Storefront. With that implementation, it is not possible to display these products via Twig, so you will need to do this via JavaScript.

1[DOMAIN]/cart/cross?sku=[SKU1],[SKU2]

You will receive a response as an array with the product data as objects.

JavaScript example

Within the template, you can retrieve this as follows. The example logs the response to the console.

1$.ajax({
2    url: "https://template.afosto.com/cart/cross?sku=1087517",
3    success: function(result){
4        console.log(result);
5    },
6})