Similar Products
2 min
If you haven't gone through the prerequisites and the v2 structure, please have a look at Overview
Klevu can power a recommendation banner showcasing any products which are similar to the current product. The most common placements for this banner type are:
Product Page: You May Also Like Show a recommendation banner with similar products from the store.
Similar Products
The end-point is used for retrieving Similar products.
POST
https://eucs19v2.ksearchnet.com/cs/v2/search
var data = JSON.stringify({"recordQueries":[{"id":"recsSimilar","typeOfRequest":"RECS_SIMILAR","settings":{"context":{"recentObjects":[{"typeOfRecord":"KLEVU_PRODUCT","records":[{"id":34322682183811}]}]},"typeOfRecords":["KLEVU_PRODUCT"]}}],"context":{"apiKeys":["klevu-158755634955912036"]}});
var xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://eucs19v2.ksearchnet.com/cs/v2/search");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);Try it here!