Analytics

How Shopify's product recommendations work

How Shopify picks related and complementary products, what data it uses, how to add and improve recommendations in a theme, and how to measure them.

·6 min read·By the ROASaurus team

Key takeaways
  • Shopify has two kinds of recommendations: related products, which Shopify generates, and complementary products, which you choose in the Search & Discovery app.
  • Related products come from purchase history (bought together) and similar product descriptions, with shared collections as a fallback.
  • Shopify links up to ten products to each product; sold-out items, $0 products, gift cards and items already in the cart are left out.
  • You improve them with better product data, hand-picked complements and fewer junk collections, not with a setting for the algorithm.
  • Measure them with click-through on the recommendation block, items per order and average order value, compared over the same period length.

Shopify's product recommendations are the "You may also like" and "Pairs well with" blocks a theme shows on product and cart pages. Shopify offers two kinds. Related products are generated automatically from what customers buy together and from how similar products are. Complementary products are the ones you choose yourself, in Shopify's free Search & Discovery app. Your theme asks Shopify for either list and shows it.

This guide explains what goes into each list, whether it is AI and whether it is personalised, how to add recommendations to a theme, how to make them better, when an app is worth it, and how to measure whether they earn anything.

What is Shopify's product recommendations algorithm?

It is the logic behind Shopify's Product Recommendations API, which themes call to get a list of products for a given product. You ask for one of two intents:

IntentWhat it showsWho decidesTypical heading
relatedProducts similar to the one being viewedShopify, automaticallyYou may also like
complementaryProducts that go with the one being viewedYou, in Search & DiscoveryPair it with
The two intents in Shopify's Product Recommendations API.

According to Shopify's developer documentation, related products are predicted from three inputs:

Purchase historyProducts that are often bought together in your store
Product descriptionsProducts with similar descriptions
Related collectionsProducts in the same collections (fallback only)
Purchase history and descriptions are used for every store. Shared collections are used only when the other two give nothing. The all and frontpage collections are ignored.

The details that matter in practice:

  • Shopify links up to ten related products to each product, ranked by relevance. Most themes show about four.
  • Out-of-stock products, products priced at 0, gift cards and products already in the visitor's cart are left out.
  • Orders imported from another store or platform are not used. A new store, or one that just migrated, starts with little purchase history, so descriptions and collections carry more weight at first.
  • You cannot tell the algorithm to exclude a product. A theme can filter the returned list with code, and Search & Discovery can change the results.

How do complementary product recommendations work?

Complementary products are set by hand. In the Search & Discovery app you open a product and pick the items that go with it: the case for the phone, the refill for the bottle, the cleaner for the leather shoes. Your theme then shows them wherever it asks for the complementary intent. Because you choose them, they are only as good as your choices, and they need upkeep when products change.

Does Shopify use AI or machine learning for recommendations?

Related products are predicted from patterns in your data, which is a form of machine learning, and Shopify does not publish the exact method. Complementary products are not generated: you set them.

Does Shopify personalise recommendations for each visitor?

Shopify's documentation describes recommendations per product, not per visitor. The one visitor-specific rule it documents is that products already in the visitor's cart are left out. So two visitors looking at the same product will mostly see the same list. If you need recommendations based on each visitor's browsing in the session, that is where third-party apps come in.

Is Shopify Sidekick a recommendation engine?

No. Sidekick is an assistant for you, the merchant, in the Shopify admin. It can answer questions about your sales and help with tasks, but it does not choose which products shoppers see on the storefront. See Shopify's AI features.

How do you add product recommendations to a Shopify theme?

Most current themes have a product recommendations section built in: open the theme editor, go to a product template and add or enable the "Related products" or "Complementary products" block. For a custom theme, the pattern from Shopify's documentation is:

  1. Add a section with the recommendations object

    In Liquid, check recommendations.performed? and loop over recommendations.products. The object is empty on the first page load.

  2. Load the section after the page

    Give the section a data-url built from routes.product_recommendations_url, with the section id, the product id, a limit and the intent.

  3. Fetch it when it comes into view

    A small script requests that URL when the section nears the screen and swaps in the returned HTML.

  4. Handle an empty list

    Hide the section, or show a fallback, when no products come back.

Liquid: the section placeholder
{%- comment -%} The data-url the section fetches {%- endcomment -%}
<div class="product-recommendations"
  data-url="{{ routes.product_recommendations_url }}?section_id={{ section.id }}&product_id={{ product.id }}&limit=4&intent=related">
</div>

Use the product URLs the API returns, so Shopify's own analytics can count clicks on recommended products.

How do you improve Shopify's recommendation accuracy?

  • Write real product descriptions. Similar descriptions are one of the inputs. Thin or copied supplier text makes unrelated products look alike.
  • Clean up collections. Collections are the fallback. A "Sale" or "New" collection with everything in it creates weak matches. Make collections meaningful, such as by use or by product type.
  • Set complements by hand. For products with obvious add-ons, choose them yourself instead of hoping the related list finds them.
  • Keep stock accurate. Sold-out products are dropped, so wrong stock numbers remove good recommendations.
  • Give it time. Purchase history grows with orders. A new store's recommendations get better as it sells.
  • Use Search & Discovery. It lets you adjust results and set complements without code.

When should you use a third-party recommendation app instead?

Shopify's own recommendations are enough when
  • Your catalogue is small or medium
  • Product pairings are obvious and you can set them
  • You mainly need a block on the product page
  • You want no extra monthly fee
Consider an app when
  • You want recommendations per visitor, based on the session
  • You want to favour high-margin or overstocked products
  • You need recommendations in the cart, checkout, post-purchase and email
  • You want built-in testing of placements and rules

Apps in this space differ in focus: some cover the whole store and email, some focus on the cart and post-purchase moment, and some only add "frequently bought together" blocks. Compare current listings on the Shopify App Store, and see upsell apps for Shopify for the cart and post-purchase side.

How do you measure whether recommendations are working?

Recommendations should raise items per order and average order value without lowering conversion. Compare equal periods, or better, test with and without the block. An example with example numbers:

Example store, 30 daysWithout blockWith block
Sessions40,00040,000
Orders1,0001,010
Items per order1.301.42
Average order value$58.00$62.50
Revenue$58,000$63,125
Example data. Orders barely move; the gain comes from more items per order. Check that the extra items carry a margin worth having.

Watch three things: clicks on the recommendation block (Shopify's analytics can attribute them when the theme uses the returned URLs), items per order, and average order value. Then check profit: recommending low-margin add-ons can raise revenue and lower profit per order.

Measure recommendations in ROASaurus

The ROASaurus Mac app showing the Dashboard for the last 30 days: revenue, net profit, ad spend, ROAS and orders against the 30 days before. Fictional demo store, simulated data.
The ROASaurus iPhone app showing the Dashboard for the last 30 days: revenue, net profit, ad spend, ROAS and orders against the 30 days before. Fictional demo store, simulated data.
Today › Dashboard in the public demo (ROASaurus Demo Store, a fictional store): units sold, add to carts, conversion rate and AOV next to profit.

ROASaurus measures the effect of recommendations with its own storefront events and your orders:

  • Today › Dashboard compares units sold, AOV, add to carts, conversion rate and profit with the previous period.
  • Profit › Products › Product conversion shows per product the viewers, adds to cart, cart rate, buy rate and revenue per viewer. A recommended add-on whose cart rate rises after you add the block is doing its job.
  • Website › Visitors shows sessions, add-to-cart rate, conversion rate and revenue per session by source, device and landing page, so you can see whether a change helped every kind of visitor.
  • Profit › Products shows margin and profit after ad spend per product, so you can check that the products you recommend are worth recommending.

Next step

Sources

  1. Shopify Dev Docs: Product recommendations
  2. Shopify Dev Docs: Show product recommendations (related products)
  3. Shopify App Store: Shopify Search & Discovery

In ROASaurus

Keep reading

AIShopify's AI features: what each one doesWhat Shopify Magic, Sidekick, AI search and the other Shopify AI features do, what they cost, where they help profit and where they fall short.CustomersUpsell apps for Shopify: types, and how to tell they workThe kinds of Shopify upsell apps (cart, bundles, gifts, post-purchase), what to look for, and a three-step test to see whether an upsell app adds profit.AnalyticsA/B testing on Shopify: a practical guideHow to A/B test on Shopify: hypothesis, sample size, what to test, apps vs Rollouts, reading results, and checking the winner also wins on profit.

FAQ

Questions, answered

More answers in the FAQ and the help center.

Does Shopify's recommendation algorithm use AI?

Related products are predicted from purchase history and similar product descriptions, which is a form of machine learning. Shopify does not publish the exact model. Complementary products are chosen by you.

Are complementary product recommendations AI-generated?

No. In Shopify, complementary products are set manually in the Search & Discovery app. Your theme then shows the products you picked.

Does Shopify personalise recommendations per visitor in real time?

Shopify documents recommendations per product. The visitor-specific rule it documents is that products already in the cart are left out. For per-visitor recommendations, use an app.

How many products does Shopify recommend?

Shopify links up to ten related products to each product, ranked by relevance. Themes usually show four, set with the limit parameter.

Why are my Shopify recommendations not showing?

A new store may not have enough purchase history yet, the products may be sold out or priced at 0, or the theme may not include a recommendations section. Imported orders are not used.

Every sale, traced to the ad that earned it

Server-side tracking, profit and lifetime value in one app. Free plan, no credit card.