The recommendations object
recommendations object provides product recommendations that are related to a given product, based on data from sales, product descriptions, and relations between products and collections. Product recommendations become more accurate over time as new orders and product data become available. To learn more about how product recommendations work, see Showing product recommendations on product pages.
recommendations object returns products only if it's used in a theme section that's rendered through an HTTP request to
section_id is the ID of the section where the
recommendations object is being used, and
product_id is the ID of the product you want to show recommended products for. To determine the
base_url, use the
routes.product_recommendations_url attribute. Using the
routes object rather than a hardcoded URL ensures that the product recommendations load in the correct locale.
To learn how to implement the
recommendations object, see Showing product recommendations with the Product Recommendations API section response.
recommendations object has the following attributes:
true if the
recommendations object is referenced inside a theme section that is rendered through the recommendations endpoint with valid parameters:
|product_id||id of the product you want to show recommended products for||yes|
|section_id||id of the section where the
|limit||Limits number of results, up to a maximum of ten||no|
Returns the number of product recommendations, or returns 0 if
Returns product recommendations. These objects are products. Doesn't return any product if
For example, this Liquid snippet creates the conditions to show product recommendations:
It produces the following output when the enclosing section is rendered synchronously:
And it produces the following output when the enclosing section is rendered from the endpoint