# Query - Liquid tag reference

Source: https://support.storeconnect.com/articles/query-tag-reference · Last modified 21 August 2026

The `query` simple tag fetches Salesforce records from the StoreConnect database and assigns the result set to a Liquid variable for rendering.

## Syntax


```liquid

{%- query <object_name> as <variable_name>
    [, <field>: <value>, ...]
    [order by '<field> [asc|desc], ...'] -%}
```


| Property     | Value          |
|--------------|----------------|
| **Tag name** | `query`        |
| **Type**     | Simple tag     |
| **Source**   | StoreConnect   |

## Description

The `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 (`>`, `>=`, `<`, `<=`), LIKE patterns (`%`), IN arrays, and `data.<field>` custom-data filters are supported, along with an optional quoted `order by` clause.

## Quick example


```liquid

{%- query 'Product2' as records, s_c__slug__c: 'hiking-boots' -%}

{%- for record in records -%}
  {{ record.name }}
{%- endfor -%}
```


For 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).

---

## Follow StoreConnect

- [Email Newsletter](https://getstoreconnect.com/c/lp-newsletter)
- [LinkedIn Newsletter](https://www.linkedin.com/build-relation/newsletter-follow?entityUrn=7444956928444862464)
- [YouTube](https://www.youtube.com/channel/UCngKdP2x8l1wcbAKW3tvU8g)
- [LinkedIn](https://www.linkedin.com/company/storeconnect)
- [X / Twitter](https://x.com/storeconnecthq)

## Popular Links

- [Partners](https://getstoreconnect.com/partners)
- [News](https://getstoreconnect.com/articles/news)
- [Events](https://getstoreconnect.com/articles/events)
- [Feature Comparison](https://getstoreconnect.com/how-we-compare)
- [Download a free trial](https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FMkeKUAT)
- [Book a Demo](https://getstoreconnect.com/contact)

## Documentation

- [Help documentation](https://support.storeconnect.com/help-documentation)
- [AI agents](https://support.storeconnect.com/ai)
- [Videos & tutorials](https://support.storeconnect.com/videos-tutorials)
- [Developer reference](https://support.storeconnect.com/developer-reference)
- [Release notes](https://support.storeconnect.com/release-notes)
- [Troubleshooting](https://support.storeconnect.com/troubleshooting)
- [Trust Center](https://trust.getstoreconnect.com/)
- [Status Page](https://status.storeconnect.com/)

## Contact

- info@getstoreconnect.com
- US +1 415 745 3230
- AUS +61 2 8365 2308

100 S Ashley Dr, Suite 600-2461
Tampa FL 33602-600 USA

Level 22, Sydney Place
180 George Street
Sydney, NSW, 2000, AUS

---

StoreConnect Support — https://support.storeconnect.com/articles/query-tag-reference