Show only products in storefront search results

To restrict search results on your store to products only:

  1. From your Shopify admin, click Online Store, and then click Themes (or press G W T).

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

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

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

    /search
    
  5. 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
  6. Save your changes.

  7. 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