Skip to main content

productRelationSuggestions

Requires permission products:product:read.

Returns up to 20 upsell, cross-sell or substitute suggestions for a set of products, for example a customer's purchase history. Each suggested product appears once, deleted products are left out, and the list is empty when nothing is set up. Needs the products read permission.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

query ProductRelationSuggestions($productIds: [String!]!) {
productRelationSuggestions(productIds: $productIds) {
id
type
note
relatedProduct {
id
name
imageUrl
}
}
}

Variables:

{
"productIds": [
"string"
]
}

Response:

{
"data": {
"productRelationSuggestions": [
{
"id": "id",
"type": "CROSS_SELL",
"note": "string",
"relatedProduct": {
"id": "id",
"name": "string",
"imageUrl": "string"
}
}
]
}
}
productRelationSuggestions(
productIds: [String!]!
): [ProductRelationSuggestion!]!

Arguments​

productRelationSuggestions.productIds ● [String!]! non-null scalar​

The IDs of the source products to find suggestions for.

Type​

ProductRelationSuggestion object​

A suggested related product.