Last active
April 10, 2021 14:03
-
-
Save michelarteta/ccc525f3f55ab54f61d5191519e48ac7 to your computer and use it in GitHub Desktop.
Shopify SKU Search Endpoint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- layout none -%} | |
{%- comment -%} | |
/* | |
* Shopify SKU Search Endpoint | |
* Add this file to your /templates directory | |
* Endpoint: http://www.myshopify.com/search?view=json&q=&q=variants.sku:001159284 | |
* | |
*/ | |
{%- endcomment -%} | |
{%- paginate search.results by 10 -%} | |
{%- if search.performed -%} | |
{"products": [ | |
{%- for item in search.results -%} | |
{%- unless item.object_type == 'product' -%}{%- continue -%}{%- endunless -%} | |
{{- item | json -}} | |
{%- unless forloop.last %},{% endunless -%} | |
{%- endfor -%} | |
]} | |
{%- endif -%} | |
{%- endpaginate -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment