list-crosssell-products
Method: GET
Path: /catalog/products/cross-sell
Tags: Products
Summary
Retrieve cross-sell products
Description
Retrieves the cross-sell products of the products in product_id, or the store's cross-sell products without it. Returns only products the customer can add to the cart now: active, in stock, priced and on the customer's sales channel. A product with variants appears only as one of its variants.
Storefront SDK Usage
SDK Method: sdk.catalog.listCrossSellProducts()
Example:
// Basic usage - get cross-sell products for cart items
const { data, error } = await sdk.catalog.listCrossSellProducts({
product_id: ["prod_01H9XYZ12345ABCDE", "prod_01H9ABC67890FGHIJ"]
});
// Advanced usage with pagination
const { data, error } = await sdk.catalog.listCrossSellProducts({
product_id: ["prod_01H9XYZ12345ABCDE"],
page: 1,
limit: 10
});
// Override customer group ID for this specific request
const { data, error } = await sdk.catalog.listCrossSellProducts(
{
product_id: ["prod_01H9XYZ12345ABCDE"],
page: 1,
limit: 10
},
{
"x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
}
);
if (error) {
console.error("Failed to get cross-sell products:", error.message);
} else {
console.log("Cross-sell products found:", data.products.length);
console.log("Pagination:", data.pagination);
data.products.forEach(product => {
console.log(`Product: ${product.product_name} - ${product.pricing?.selling_price}`);
});
}TypeScript Definition
"list-crosssell-products": {
parameters: {
query?: {
/** @description Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400. */
limit?: number;
/** @description Page number, starting at 1. Non-integer values and values below 1 return 400. */
page?: number;
/** @description Product ids of cart items */
product_id?: string[];
};
header?: {
/** @description This param is used to determine product pricing, promotions, and subscription rates. If a valid customer group id is provided, pricing details will be retrieved accordingly. If no matching data is found for the specified customer group id, the system will fall back to the default customer group id. If no data is found for the default group either, the highest applicable price will be returned. */
"x-customer-group-id"?: components["parameters"]["CustomerGroupId"];
};
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Success response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
products: components["schemas"]["CatalogListItem"][];
pagination: components["schemas"]["Pagination"];
};
};
};
};
/** @description The request parameters or customer group are invalid. */
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["parameters"]["CustomerGroupId"] | CustomerGroupId |
components["schemas"]["CatalogListItem"] | CatalogListItem |
components["schemas"]["Pagination"] | Pagination |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Parameters
- x-customer-group-id (header): This param is used to determine product pricing, promotions, and subscription rates. If a valid customer group id is provided, pricing details will be retrieved accordingly. If no matching data is found for the specified customer group id, the system will fall back to the default customer group id. If no data is found for the default group either, the highest applicable price will be returned.
- limit (query): Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400.
- page (query): Page number, starting at 1. Non-integer values and values below 1 return 400.
- product_id (query): Product ids of cart items
Responses
200
Success response
400
Bad request
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
{
"tags": [
"Products"
],
"operationId": "list-crosssell-products",
"summary": "Retrieve cross-sell products",
"description": "Retrieves the cross-sell products of the products in `product_id`, or the store's cross-sell products without it. Returns only products the customer can add to the cart now: active, in stock, priced and on the customer's sales channel. A product with variants appears only as one of its variants.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/list-crosssell-products",
"description": "API reference for the list-crosssell-products operation"
},
"parameters": [
{
"$ref": "#/components/parameters/CustomerGroupId"
},
{
"name": "limit",
"in": "query",
"description": "Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400.",
"schema": {
"type": "integer",
"maximum": 100,
"minimum": 1
}
},
{
"name": "page",
"in": "query",
"description": "Page number, starting at 1. Non-integer values and values below 1 return 400.",
"schema": {
"type": "integer",
"minimum": 1
}
},
{
"name": "product_id",
"in": "query",
"description": "Product ids of cart items",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"explode": false,
"style": "form"
}
],
"responses": {
"200": {
"description": "Success response",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"products": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CatalogListItem"
}
},
"pagination": {
"$ref": "#/components/schemas/Pagination"
}
},
"required": [
"products",
"pagination"
],
"type": "object"
}
}
}
}
},
"links": {
"AddItemToCart": {
"operationId": "update-cart",
"requestBody": {
"product_id": "$response.body#/content/products/0/product_id",
"variant_id": "$response.body#/content/products/0/variant_id"
},
"description": "Add a cross-sell product to a cart."
}
}
},
"400": {
"description": "The request parameters or customer group are invalid.",
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"security": [
{
"Authorization": []
},
{
"X-Api-Key": []
}
],
"x-speakeasy-group": "catalog",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "listCrosssellProducts"
}Auto-generated from OpenAPI spec and TypeScript definitions