Skip to main content
All CollectionsOther FeaturesProduct Recommendations
Simple Recommendations API for Shopify
Simple Recommendations API for Shopify
Updated over a week ago

What is Simple Recommendations API for Shopify in Webtrends Optimize?

Our Simple Recommendations API for Shopify allows you to fetch a filtered view of your product list, used typically for recommendation carousels.

This document assumes the data collection has been established on our side. If you're not aware of your endpoint, please as us beforehand.

Request body

POST /endpoint

{
"required": {
"attribute": "value", // required. please provide attributes to filter on.
"attribute2": "value2"
},
"limit": 5, // optional, default is 10
"currentProduct": "handle-for-some-product" // optional. will remove this product from the returned dataset if provided.
}

Input options:

Where value is any of

If the value you want to match is a String or Number type, e.g. sleeve-length, colour, etc., you have the option for a 1:1 match, or many:1 match.

For example, in the above required object, you could provide "colour": "red" to match only red colours, or "colour": ["red", "blue"] to match products which are either red or blue.

minPrice, maxPrice

Coded into the API, you also have the option to filter by minPrice: 99.50 or maxPrice: 123.45. Pass these into the required object along with all other filters to the dataset.

Response

You should expect a response back similar to:

[
{
"id": 0123456789,
"title": "PROUDUCT TITLE",
"handle": "product-handle",
"img": "https://cdn.shopify.com/s/files/something.jpg",
"attribute": "value",
"cat": [
"category-1",
"category-2"
],
"sizes": [
"UK 10",
"UK 12",
"UK 14"
],
"price": 124.99,
"attribute2": "value2",
"calculatedAttribute": true
},
...
]

With this data, you can then render your front-end experience.

Note: We only provide price as a rough guide here. To handle multi-currency websites and ensure prices are 100% accurate at time of rendering, you should fetch these using AJAX from the relevant PDPs before rendering your experience.

With Shopify, you can access your full dataset at the URL mydomain.com/products/[product-handle].json, e.g. wtostore.com/products/shopify-recommendations-api.json (not a real website).

Configuration

We will also provide you with a Google Doc, where you can map your "tags" to joint categories. This is necessary, as we will then want to filter on these categories. E.g. colour is "red" or "blue", brand is "nike" or "adidas", etc.

The available types are text and boolean.

  • text - we can do simple matching based on this - does the colour for each product match the one you provided?

  • boolean - simple true/false, based on whether we find a tag or not. E.g. "isKids", if tag "sizechart-kids" is found in the tag list.

Did this answer your question?