Sort

This guide explains how users (or the front office) can control the order of displayed products in listings or search results.

Sorting defines the order in which products are displayed in search results or product listings.
It helps users organize products according to specific criteria, such as price, name, or creation date.
Sorting can be combined with filters, search queries, or navigation categories.

Sorting Parameter

ParameterTypeLocationDescription
sortstringquerySorting criteria in the format fieldName|direction

Format:

sort=fieldName|direction
  • fieldName → defines the field used for sorting (standard, attribute, or custom field)
  • direction → defines the order of results:
    • ASC (ascending) → from lowest to highest (A → Z, oldest → newest, lowest price → highest price)
    • DESC (descending) → from highest to lowest (Z → A, newest → oldest, highest price → lowest price)

Standard Sorting

These are the default fields available for all indexed products.

Field NameDescriptionExample
nameSorts products alphabetically by name.`sort=name
priceSorts by product price (lowest to highest or vice versa).`sort=price'
createdTimeSorts products by creation date.`sort=createdTime
# Sort by creation date (oldest to newest)
GET /v2/shop/search?locale=fr-FR&currency=EUR&sort=createdTime|ASC


# Sort by price (highest to lowest)
GET /v2/shop/search?locale=fr-FR&currency=EUR&sort=price|DESC


# Sort by name (A–Z)
GET /v2/shop/search?locale=fr-FR&currency=EUR&sort=name|ASC

Custom Sorting

In addition to standard fields, sorting can also be performed using Attributes or Custom Fields. These must be indexed and marked as sortable via the API configuration.

API :PUT v1/classification-categories/{ClassificationCategoryId}/attribute-settings

[
  {
    "attributeId": "string",
    "enabled": true,
    "indexable": true,
    "required": true,
    "searchable": true,
    "sortable": true
  }
]
TypePrefixBack Office RequirementExample
Attributeattr.indexable=true and sortable=true (API)`sort=attr.color
Custom Fieldcf.indexable=true and sortable=true (API)`sort=cf.promo
# Sort by an indexed product attribute (Color)
GET /v2/shop/search?locale=fr-FR&currency=EUR&sort=attr.color|ASC


# Sort by an indexed custom field (Promo)
GET /v2/shop/search?locale=fr-FR&currency=EUR&sort=cf.promo|DESC
❗️

Products without a value for the specified field appear at the end of the results.


Multiple Sorting Criteria

You can apply multiple sorting criteria in a single request. Sorting is applied sequentially, from left to right.

GET /v2/shop/search?locale=fr-FR&currency=EUR&sort=cf.promo|ASC,price|DESC

Result:

  • Products are first sorted by Promo (ascending).
  • Within those groups, by Price (descending).

Best Practices

  • Keep sorting options simple for better usability in the front office.
  • Avoid sorting on fields that contain inconsistent or sparse values.
  • Combine sorting and filtering for precise product ordering.