Fixes · Product recommendations

Product recommendations full of products with most sizes sold out

The fix

Recommendation sources leave out products that are sold out altogether. A product with one size left still gets recommended, and to a shopper looking for their size it reads as out of stock.

Count the sizes in stock on each card and hide any below a number the team sets, keeping products sold in one size. Measure what the carousel shows before you build.

01Why nearly sold-out products slip through

Recommendation tools think in whole products. Rebuy’s trending products endpoint has a filter_oos option that “Excludes products that are out of stock (OOS) from the response”, on by default (Rebuy developers). Shopify’s Product Recommendations API returns up to 10 related or complementary products (Shopify), and Shopify’s help says a recommended product shows only if “It isn’t sold out” (Shopify Help Center). On this Community thread (Nov 2023) a merchant asks how to show sold-out products anyway.

Neither looks at sizes. A jacket in six sizes with one left is in stock to both. Kimonix calls engines that ignore stock levels “inventory-blind” (Kimonix). On the store below, it was about 63% of the recommendations we counted.

So when a team says the carousel is “full of out-of-stock products” and the data says nothing in it is sold out, both are right. On that store, neither Shopify nor the recommendations app had a setting for it (Aug 2026), so it’s a theme change.

02Measure first, then let the team set a number

For store owners

  1. Look before you ask for a fix

    Open a few product pages and the cart, and for each recommended product note how many sizes are left. If none is fully sold out, the problem is nearly sold-out products, and the fix below is the one you need.

  2. Agree a number

    For example: hide anything with fewer than three sizes in stock. Products sold in one size (caps, socks, gloves) shouldn’t count, or a higher number hides every one of them.

  3. Ask for it as a theme setting

    So the team can change it in the theme editor, without a developer, as the season moves on.

For developers: put stock on the card, filter after it’s drawn

If the carousel draws its products with the theme’s own card snippet (through the Section Rendering API, say), the card can carry its own stock. The filter then works the same whichever source supplied the products. This is the shape of what we shipped, generalised:

The card carries its stock (Liquid)liquid
{%- liquid
  assign variants_available = 0
  for variant in product.variants
    if variant.available
      assign variants_available = variants_available | plus: 1
    endif
  endfor
-%}
<div
  data-product-card
  data-available="{{ product.available }}"
  data-variants-available="{{ variants_available }}"
  data-variants-total="{{ product.variants.size }}">
  ...
</div>
Keep or drop each cardjs
function passesStockFilter(card, minSizes) {
  const inStock = parseInt(card.dataset.variantsAvailable, 10);
  const total = parseInt(card.dataset.variantsTotal, 10);

  if (card.dataset.available === undefined) return true; // can't read it: keep
  if (card.dataset.available !== 'true') return false;   // sold out: always drop
  if (!minSizes || minSizes < 2) return true;          // filter off
  if (!total || total < 2) return true;                // one-size products stay
  if (Number.isNaN(inStock)) return true;              // can't tell: keep it
  return inStock >= minSizes;
}
The setting (config/settings_schema.json)json
{
  "type": "range",
  "id": "recommendations_min_sizes",
  "label": "Minimum sizes in stock",
  "min": 1,
  "max": 6,
  "step": 1,
  "default": 1,
  "info": "Hides recommended products with fewer than this many sizes still in stock. At 1, only fully sold-out products are hidden."
}
  • This counts variants. If your products vary by colour as well as size, count the sizes with stock instead, or the numbers mean something else.
  • Ask for more products than you show, but only when the filter is on, so a filtered row stays full and page weight doesn’t change at the default. We ask Shopify for 10 (its maximum) instead of 8 when the number is above 1.
  • Time the source before you ask it for more. With filter_oos on, Rebuy’s trending endpoint took 3.6 seconds at a limit of 8 and 44.6 seconds at 10 when we measured it (13 Aug 2026), so we don’t ask it for more, and the cart row can show one or two fewer.
  • Keep a card you can’t read. If the card markup changes, the carousel falls back to what it did before, rather than going empty.

03Raise the number and count the cards

  1. At the default, nothing changes

    With the setting at 1, the carousels should show the same products as before.

  2. Raise it and count

    Set it to 3 and open a product page. Every card should have three or more sizes in stock, or only one size.

  3. Look at the cart

    The cart’s row may be a card or two shorter. It should still appear, and quickly.

From our work

04We measured before we built

A sportswear retailer we look after, with two stores, asked us to stop its recommendation carousels showing out-of-stock products, on product pages and in the cart. One store’s carousels came from Rebuy, the other’s from Shopify’s own recommendations. We had already turned on Rebuy’s filter_oos for the cart’s trending row (30 Jul 2026). The team still saw them.

We measured first (13 Aug 2026). Neither store was recommending a fully sold-out product: none in 1,200 recommendation slots on one store, and no sold-out badge on 96 cards drawn on the page. But about 63% of recommendations on both stores were down to a fraction of their sizes. That is what read as out of stock to the team.

What we built. The card filter above, on both stores, with a Minimum sizes in stock setting in the theme editor (Theme settings > Product recommendations). Products sold in one size are never hidden. It starts at 1, so nothing changed until the team chose a number. At 3 on a preview, a product page showed eight products, each with three or more sizes in stock or sold in one size, and the cart showed seven.

On the store we checked today (23 Oct 2026) the setting is still at 1, so only sold-out products are hidden there. Raising it is the team’s choice: a higher number means fewer products in each row.

The bigger picture

05When the data and the team disagree

When a team says the store shows out-of-stock products and the data says it doesn’t, look at what a shopper sees before changing anything. The fix that helps is often a setting the team controls, not a fixed rule.

Work like this, measured on the live store and built so the team owns the setting, is what our support work covers.

06Sources

Every step and claim above comes from one of these, or from the fix on the store it describes.

  1. Rebuy developers: Trending Products (filter_oos)
  2. Shopify developers: Product Recommendations API reference
  3. Shopify Help Center: Customize product recommendations
  4. Shopify Community: Show product recommendations even when products are sold out (Nov 2023)
  5. Kimonix: Still showing low-stock products in your recommendations?

Sources checked on .

Contact

Recommendations showing the wrong products?

Send us a product page where it happens, and say what the team would rather see.