PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] How to Display only products in shopify search results?

 June 30, 2022     for-loop, if-statement, shopify     No comments   

Issue

I want to display only products from Shopify products but there are showing also pages and posts here is my code for search result:

<div class="product-list">
    {% if grid_results == false %}
    {% for item in search.results %}
    {% include 'search-result' %}
    {% endfor %}
    {% else %}
    <div class="grid-uniform">
      {% for item in search.results %}
      {% include 'search-result-grid' %}
      {% endfor %}
    </div>
    {% endif %}
    {% endif %}
  </div>

Now I got the following code:

{% if item.object_type == 'product' %}

But where to put this code so I can get only products for search any text.


Solution

Shopify has excellent self help guides for most of the stuff. Here's one such

Show only products in storefront search results



Answered By - HymnZzy
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing