質問

I am building an application for a shopify store and have a requirement of displaying products using a keyword that the user enters.

I searched over and found this url working:

...e.myshopify.com/search?q=short&type=product&view=json

where I append the keyword to the ?q variable. But i need a JSON response for my application. It does not gives a Json response even after mentioning the view=json field.

Pleas help.

Thanks in advance.

役に立ちましたか?

解決

The trick is to write a simple template in your theme to render the JSON you need in response to that JSON view. Just create the file templates/search.json.liquid, which can be as simple as the following:

{% layout none %}
{{ search.results | json }}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top