Shopify sold out guide

How to hide out of stock products on Shopify

What you’ll need

  • A duplicate of your theme to test on

    How to get this: A duplicate of your theme to test on
    1. Online Store › Themes › … on your theme › Duplicate.
    2. Make the change on the copy, preview it, and publish only when it works.

    Step-by-step guide (opens in a new tab)

  • The theme editor (to add a Custom Liquid block; no code editing)

    How to get this: The theme editor
    1. Online Store › Themes › Edit theme (on a copy of your theme if you want to test first).
    2. Add section or Add block › Custom Liquid, paste the code, then Save.

    Step-by-step guide (opens in a new tab)

  • Shopify’s free GraphiQL app (with read_products, write_products (for the collections step) access)

    How to get this: Shopify’s free GraphiQL app
    1. Install it once from shopify-graphiql-app.shopifycloud.com: enter your store address, tick the access listed here, click Install and approve.
    2. Then open it any time from Apps › Shopify GraphiQL App in your admin.

    Step-by-step guide (opens in a new tab)

Hide them in all collections at once

Collections: the inventory condition

  1. Turn on inventory tracking for the products (Inventory tracked on each variant).
  2. Products › Collections › open an automated collection.
  3. Make sure it says Products must match: all conditions.
  4. Add the condition Inventory stock › is greater than › 0 and Save.
  5. Repeat for each collection, or let the tool write one update for all of them.

What the inventory condition counts

The Inventory stock condition adds up Available units at every location, including locations that don’t fulfill online orders, and ignores Continue selling. So a product whose only stock sits at a location with “Use inventory at this location to fulfill online orders” off stays in the collection while the storefront shows Sold out. Products whose units are all Committed (in unfulfilled orders) or Unavailable (damaged, safety stock) leave it, and so does a pre-order product at 0 with Continue selling on. Removing the condition puts every product back.

Install Shopify’s free Search & Discovery app, then go to Settings › Out of stock products. Pick Hide, Show last (the default) or Show. It changes the search page and predictive search only.

Other ways, and their catch

  • Shopify Flow’s unpublish templates take sold-out products off the Online Store and put them back when restocked. The product page disappears too, which can cost search rankings.
  • Skipping sold-out products in the collection loop (Liquid) leaves gaps: pages show fewer products and the count is wrong, because Shopify paginates before your code runs.
  • An In stock filter link (?filter.v.availability=1) shows only available products when customers arrive through that link.

Questions

Do products come back when restocked?

Yes. Automated collections re-check the condition, so a product returns as soon as it has Available stock again.

Does this work for manual collections?

No, manual collections have no conditions. Convert the collection to automated, or move sold-out products to the end instead.

More guides