Search route json response

Our theme, Trademark, in the search makes as ajax call to the search route which returns a list of products. I cannot locate the documentation related to the json response or the results of the response.

Example:

/search?q=test&view=json

returns

{
  "results": [...], // truncated
  "results_count": 73,
  "results_label": "View results (73)",
  "url": "/search?q=test"
}

First, where is the view parameter documented for the search route? I would think in the Storefront search or Search object, but it’s not.

Second, each result according to the search object should be a product (it can be other things, but ours is configured for products).

Each result looks like this (with actual values, of course):

{
      "object_type": "product",
      "vendor": "",
      "title": "",
      "url": "",
      "on_sale": false,
      "price": "$",
      "compare_at_price": "",
      "image": "",
      "image_alt": ""
}

These are not all of the fields of the Product object (e.g. missing tags) nor does on_sale even appear in the documentation.

What’s going on? And where can I find what’s going on?

1 Like