Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% assign lowercase_tags = customer.tags | downcase %}
- {% assign wholesale_customer = false %}
- {% if lowercase_tags contains 'wholesale' %}
- {% assign wholesale_customer = true %}
- {% endif %}
- {% layout none %}
- {% capture results %}
- {% for item in search.results %}
- {% assign wholesale_product = false %}
- {% assign show_item = nil %}
- {% for product_collection in item.collections %}
- {% if product_collection.title == 'Wholesale' %}
- {% assign wholesale_product = true %}
- {% endif %}
- {% endfor %}
- {% if wholesale_customer == true and wholesale_product == true %}
- {% assign show_item = true %}
- {% elsif wholesale_customer == false and wholesale_product == false %}
- {% assign show_item = true %}
- {% endif %}
- {% if show_item == true %}
- {
- "title": {{ item.title | json }},
- "url": {{ item.url | within: item.collections.last | json }},
- "thumbnail": {{ item.featured_image.src | product_img_url: 'thumb' | json }},
- "wholesale_customer": {{ wholesale_customer | json }},
- "wholesale_product": {{ wholesale_product | json }}
- }
- {% endif %}
- {% unless forloop.last %},{% endunless %}
- {% endfor %}
- {% endcapture %}
- {
- "results_count": {{ search.results_count }},
- "results": [{{ results }}]
- }
- {% if wholesale_customer == true and wholesale_product == true %}
- {% assign show_item = true %}
- {% assign debug = "wholesale_customer" %}
- {% elsif wholesale_customer == false and wholesale_product == false %}
- {% assign debug = "retail_customer" %}
- % assign show_item = true %}
- {% endif %}
- {% if show_item == true %}
- {
- "title": {{ item.title | json }},
- "url": {{ item.url | within: item.collections.last | json }},
- "thumbnail": {{ item.featured_image.src | product_img_url: 'thumb' | json }},
- "wholesale_customer": {{ wholesale_customer | json }},
- "wholesale_product": {{ wholesale_product | json }},
- "debug": {{ debug | json }}
- }
- {% endif %}
Add Comment
Please, Sign In to add comment