Shopify Builds>Primitives>Product Recommendations API

Product Recommendations API

Definition

The Product Recommendations API is a Shopify storefront endpoint that returns products related to a given product. A request names a product id, a limit and an intent — related for similar items, complementary for items a merchant has paired with it in the Search & Discovery admin — and Shopify answers with product JSON or a rendered section. The relationships are curated and computed on Shopify's side, not the theme's.

Documented at https://shopify.dev/docs/api/ajax/reference/product-recommendations.

How we've used it

It's how merchandising decisions get out of theme settings. A cart drawer's add-on row used to be three products picked in the theme editor, which meant every shopper saw the same three and the row rotted whenever one was retired. The rebuilt version picks the first paid line in the cart as an anchor, asks for complementary results, falls back to related when nothing has been paired, and filters out anything already in the cart or tagged as a gift or sample. Responses are memoized per anchor and limit, because the drawer is re-rendered on every cart mutation and would otherwise turn a quantity change into a fetch storm. The curation lives in the admin, where the rest of the catalog relationships already do.

Builds using it

Related entities

Cart AJAX API · Section Rendering API · Storefront search

Builds