Viewed Products
Introduction
With the ‘viewed product functionality’, it is possible to gain insight into all products viewed by the customer and the contents of the shopping cart. This is possible with a method that is loading the products in the conversation and display the cart in the panel. If you use this method, you are not dependent on a page load.
Viewed products
To register a viewed product, the following method should be used.
__robin.addViewedProduct(viewedProduct)
Properties
Name | Description |
---|---|
id | Product Id or code |
name | Name of the product |
url | The URL of the product |
imageURL | The URL of the image of product |
price | The price of the product |
currency | The currency of the product price |
availability | Stock description |
Example
__robin.addViewedProduct({
id: "p1",
name: "prod 1",
description: "product 1",
url: "http://robinhq.com/",
imageUrl: "https://cm.com/product-image.jpg",
price: "1.23",
currency: "€",
availability: "Available"
});
Shopping cart
To publish the complete contents of the shopping cart, the following method should be used. It is important to keep the update the all shopping cart contents and not just the mutations.
__robin.setCartContents(cart)
Properties
Name | Description |
---|---|
id | Product Id or code |
name | Name of the product |
quantity | The quantity of the product that are placed in the cart |
unitPrice | The price of the product |
currency | The currency of the product price |
Example
__robin.setCartContents ([
{
id: "p1",
name: "prod 1",
quantity: "1",
unitPrice: "1.23",
currency: "€"
},
{
id: "p2",
name: "prod 2",
quantity: "2",
unitPrice: "4.56",
currency: "€"
}
]);
Updated about 2 years ago