Skip to main content

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​

NameDescription
idProduct Id or code
nameName of the product
urlThe URL of the product
imageUrlThe URL of the image of product
priceThe price of the product
currencyThe currency of the product price
availabilityStock 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​

NameDescription
idProduct Id or code
nameName of the product
quantityThe quantity of the product that are placed in the cart
unitPriceThe price of the product
currencyThe 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: "€"
}
]);