Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. The Developer Center continues to support Commerce 6.13.0 through 7.4.1.Visit new site

Query Format

Query Format

A simple query has the following form:

FIND <objectType> WHERE <expression>
      

where <objectType> is the type of object you want to retrieve. Supported values are:

  • Product
  • Configuration
  • Promotion
  • PriceList
  • Promotion
  • PriceListAssignment
  • TaxJurisdiction
  • TaxCode
  • PaymentGateway
  • Warehouse
  • Store
  • Customer
  • CustomerProfileAttribute
  • CmUser
  • UserRole
  • Catalog
  • Category
  • GiftCertificate
  • ShippingRegion
  • ShippingServiceLevel
  • SavedCondition
  • CmImportJob
    Note: The object type must match the exporter type specified in the export configuration file.

<expression> specifies the criteria that determines which objects to retrieve. An expression has the following form:

<field> <operator> <value>
            

where <field> is the field that contains the values you want to compare. A field represents a common characteristic of the object. For example, if you want to look for products of a specific brand, you would include the BrandCode field in your query. The supported fields are described in Supported Fields further in this appendix. Not all object types have supported fields.

<operator> is the operator you are using to perform the comparison.

<value> is the literal value you want to compare to the field values.
Note: The WHERE clause is optional. If omitted, all products are matched.

For example, the following query matches the product whose code is 10030205:

FIND Product WHERE ProductCode = '10030205'
      

In addition to searching for field values, you can also search for attribute values on products and categories. To search for a value in an attribute, the expression has the following form:

AttributeName{<attribute_name>} <operator> <value>
      

where <attribute_name> is the name of a product attribute.

For example, the following query matches all products that have the Header / Model attribute set to MX:

FIND Product WHERE AttributeName{Header / Model} = 'MX'
      

To search for a value in a product SKU attribute, use SkuAttributeName. For example, the following query matches all products that have the Header / Model SKU attribute set to MX:

FIND Product WHERE SkuAttributeName{Header / Model} = 'MX'
      
Note: Data policies or customer consents do not support any query format. You cannot import or export a specific customer consent or data policy.