Facets
When using facets, the behavior will be the same whether the object used is an attribute or a Custom Field.
Within the same facet, the behavior will be an OR. This means that the search results will return products that have at least one of the selected facet values.
Example
Facet: Color
Selected values: blue, red.
In the search results, I will get either the products that have the value red, the products that have the value blue, or the products that have both values.
Attributes and customs fields are configured in the back office.
This allows the user to define if an attribute and/or a custom field is indexed and/or facetable/filterable.
An attribute or a custom field can be either indexed only or both indexed and facetable.
If an attribute or a custom field is not configured, it will neither be indexed nor facetable.
Attribute Filters
To filter by attributes, you need to add a parameter in the search field: the attribute name followed by its value. In the call parameter, you need to add the separator: | between the attribute and its value.
Example: Color|Blue, this will return all products whose color is blue.
To allow an attribute to be facetable,, you have to set it as indexed and facetable.
It can then be used to filter results on the front office.
This attribute and its values will be available in both the product object and the facet object.
In the object:
"facets": {
"attributes": \[
{
"ID": "xxx",
"Name": "xxxx",
"Values": ["xxx", "xxxx"]
}
]
}
And in the object:
"product": {
"attributes": \[
{
"ID": "xxx",
"Name": "xxxx",
"Values": ["xxx", "xxxx"]
}
]
}
Mono attribute
GET /v2/shop/search?locale=xx-XX¤cy=XXX&attributes=AttributeName%7CAttributeValue
Use Case:
GET /v2/shop/search?locale=fr-FR¤cy=EUR&attributes=Color%7CBlue
This request will return all products/variants that have the color blue.
Multiples attributes
GET /v2/shop/search?locale=xx-XX¤cy=XXX&attributes=AttributeName%7CAttributeValue&attributes=AttributeName%7CAttributeValue
Use Case:
GET /v2/shop/search?locale=fr-FR¤cy=EUR&attributes=Color%7CBlue&attributes=Size%7CMedium
In this case, we will search for products that have the color blue and among these products, those that have the size medium.
Multiple values of attribute
GET /v2/shop/search?locale=xx-XX¤cy=XXX&attributes=AttributeName%7CAttributeValue&attributes=AttributeName%7CAttributeValue
Use Case:
GET /v2/shop/search?locale=fr-FR¤cy=EUR&attributes=Color%7CBlue&attributes=Color%7CRed
In this case, we will search for products that have the color blue or products that have the color red
Custom Fields Filters
To filter by custom fields, you need to add a parameter in the search field: the custom fields name followed by its value. In the call parameter, you need to add the separator: | between the attribute and its value.
Example: Promo|True, this will return all products in promotion.
To allow an custom fields to be facetable,, you have to set it as indexed and facetable.
It can then be used to filter results on the front office.
This custom field and its values will be available in both the product object and the facet object.
In the object:
"facets": {
"customFields": \[
{
"ID": "xxx",
"Name": "xxxx",
"Values": ["xxx", "xxxx"]
}
]
}
And in the object:
"product": {
"attributes": \[
{
"ID": "xxx",
"Name": "xxxx",
"Values": ["xxx", "xxxx"]
}
]
}
Mono Custom Field
To filter by Custom Fields, you need to add a parameter in the search field: the attribute name followed by its value. In the call parameter, you need to add the separator: | between the CF and its value.
Example: Promo|yes, this will return all products that are on promotion.
Example for a single Custom Field:
GET /v2/shop/search?locale=xx-XX¤cy=XXX&customFields=CustomFieldName%7CCustomFieldValue
Use Case
GET /v2/shop/search?locale=xx-XX¤cy=XXX&customFields=Promo%7Cyes
This request will return all products where the Promo Custom Field value is yes.
Multiples Customs fields
You can use different customs fields.
In the call parameter, you need to add the separator: | between the CF and its value, then the link: &, then the second custom field.
Example : Promo|yes and Delivery|Parcel, this request will return all products where the Promo Custom Field value is yes and the delivery method is parcel.
Example for multiple different Custom Fields:
GET /v2/shop/search?locale=xx-XX¤cy=XXX&customFields=CustomFieldName%7CCustomFieldValue&customFields=CustomFieldName%7CCustomFieldValue
Use Case
GET /v2/shop/search?locale=xx-XX¤cy=XXX&customFields=Promo%7Cyes&customFields=DeliveryType%7CParcel
Multiples values of customs fields
You can use different values for the same customs fields.
In the call parameter, you need to add the separator: | between the CF and its value, then the link: &, then put the same custom field with its other value.
Example : Promo|yes and Delivery|Parcel, this request will return all products where the Promo Custom Field value is yes and the delivery method is parcel.
Example for multiple values of the same Custom Field:
GET /v2/shop/search?locale=xx-XX¤cy=XXX&customFields=CustomFieldName%7CCustomFieldValue&customFields=CustomFieldName%7CCustomFieldValue
Use Case
GET /v2/shop/search?locale=xx-XX¤cy=XXX&customFields=DeliveryType%7CPallet&customFields=DeliveryType%7CParcel
This request will return all products where the DeliveryType Custom Field value is either pallet or parcel.
Brands
To filter by brands, you need to use the following sentence : brand={nameofthebrands}.
As the value of the brand, we use the brand name.
GET /v2/shop/search?locale=xx-XX&brand=XXX
Use Case
GET /v2/shop/search?locale=xx-XX&brand=Opo
This sentence will return all the products with the brand : Opo.
Products Tags
To filter by products tags, you need to use the following sentence : productTags={businessID}.
As the value of the product tag, we use the business ID of the product tag.
GET /v2/shop/search?locale=xx-XX&productTag=XXX
Use Case
GET /v2/shop/search?locale=xx-XX&productTag=000025
This sentence will return all the products with the business ID of product tag equals 000025 .
Updated 3 months ago