Show only products in storefront search results

To restrict search results on your store to products only:

  1. Find the theme you want to edit, click Actions, and then click Edit HTML/CSS.

  2. Under the Layouts folder, locate and click on the theme.liquid file to open it in the online code editor.

  3. In the theme.liquid file, press 'ctrl' + 'F' on a PC or 'command' + 'F' on a Mac to locate the following text:

  4. Between the opening <form> tag and closing </form> tag, add the following form field:

    <input type="hidden" name="type" value="product" />

    Your amended file should look something like this (the exact HTML used for your search form may be different depending on your theme):

    Search code
  5. Save your changes.

  6. Apply the same edit to your search.liquid template, and remember to save your file.

Your store's search function will now display only products. Go to your storefront to test it.

Want to discuss this page?

Visit the Shopify Community