{"title":"Query - Liquid tag reference","slug":"query-tag-reference","url":"https://support.storeconnect.com/articles/query-tag-reference","url_markdown":"https://support.storeconnect.com/articles/query-tag-reference.md","subtitle":null,"summary":"The `query` simple tag fetches Salesforce records from the StoreConnect database and assigns the result set to a Liquid variable for rendering.","type":"Developer_Documentation","video_url":"","keywords":"liquid, tags, query, simple tag, storeconnect","last_modified":"2026-08-21T07:12:35+0000","body_markdown":"The `query` simple tag fetches Salesforce records from the StoreConnect database and assigns the result set to a Liquid variable for rendering.\n\n## Syntax\n\n\n```liquid\n\n{%- query \u003cobject_name\u003e as \u003cvariable_name\u003e\n    [, \u003cfield\u003e: \u003cvalue\u003e, ...]\n    [order by '\u003cfield\u003e [asc|desc], ...'] -%}\n```\n\n\n| Property     | Value          |\n|--------------|----------------|\n| **Tag name** | `query`        |\n| **Type**     | Simple tag     |\n| **Source**   | StoreConnect   |\n\n## Description\n\nThe `query` tag fetches records from a Salesforce object that StoreConnect syncs to the experience-site database, and assigns the result to a Liquid variable. Conditions are joined with AND, comparison operators (`\u003e`, `\u003e=`, `\u003c`, `\u003c=`), LIKE patterns (`%`), IN arrays, and `data.\u003cfield\u003e` custom-data filters are supported, along with an optional quoted `order by` clause.\n\n## Quick example\n\n\n```liquid\n\n{%- query 'Product2' as records, s_c__slug__c: 'hiking-boots' -%}\n\n{%- for record in records -%}\n  {{ record.name }}\n{%- endfor -%}\n```\n\n\nFor the full operator matrix, ordering, distance calculations, custom data filtering, error messages, limitations, and use-case guidance, see [Liquid query (full reference)](liquid-query) and [Display dynamic content using Liquid queries](liquid-queries)."}