$wsLastSeenProducts module, you can dynamically display a customer’s recently viewed products in the frontend. This enables a personalized shopping experience and makes it easier for customers to navigate to items they have already viewed. In this section, you will learn how to load and display recently viewed products.
Module overview
Example / excerpt of$wsLastSeenProducts
ƒ() denotes a function.
Methods overview
| Method | Return type | Description |
|---|---|---|
load() | array | Loads the list of recently viewed products. |
Templates
Recently viewed products can be displayed in any template, but they are usually used on the product detail page. The display can be customized individually, for example as a list, gallery, expandable element at the bottom of the browser window, or as a sidebar element.Variables
No variables are available for$wsLastSeenProducts.
Methods
$wsLastSeenProducts.load()
Loads the list of recently viewed products. By default, the last 10 products are loaded. Signature$wsLastSeenProducts.load()
Return valuearray - List of product maps.
ExampleExample that loads the recently viewed products.
Actions
No actions are available for$wsLastSeenProducts.
Examples for data access
Check whether products are in the list
In this example, the products are assigned to a variable with$wsLastSeenProducts.load(). If the variable contains data, this means that products are in the list.
Display products
In the following example, the recently viewed products from the variable are loaded in aforeach loop and their product data is displayed.
