getCartComplement
Get "complete your cart" products by the cart from context (authorized user or guest).
Description
This method returns "complete your cart" products for the cart taken from the current context - an authorized user or a guest (resolved via the x-guest-id header, see Guest mode). It returns a Promise that resolves to an IProductsResponse object - a container with items (the products), total and totalFound - not a bare array.
Blocks.getCartComplement(
marker*,
langCode,
signPrice,
limit
);
Parameters schema
Schema
marker(required): string
Block marker
example: "cart_complement_block"
langCode: string
Language code. Default: "en_US"
example: "en_US"
signPrice: string
Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time
see: Fixing the price
limit: number
Maximum number of products to return. When omitted, the block's own quantity setting applies
example: 10
💲
signPricelocks the returned price for a limited time — set it to your order storage marker. See Fixing the price (signPrice).
Examples
Minimal example
const response = await Blocks.getCartComplement('cart_complement_block');
Example with attributes
const response = await Blocks.getCartComplement('cart_complement_block', 'en_US');
Example with limit
const response = await Blocks.getCartComplement('cart_complement_block', 'en_US', undefined, 4);
🔢
limitcaps how many products come back. Omit it and the block's own quantity setting from the admin panel keeps applying. See Limiting the number of products (limit).
Example response
{
"items": [
{
"id": 2954,
"localizeInfos": {
"title": "Box"
},
"statusIdentifier": "sale",
"statusLocalizeInfos": {
"title": "Sale"
},
"attributeSetIdentifier": "products",
"position": 1,
"templateIdentifier": null,
"shortDescTemplateIdentifier": "product_preview",
"price": 51,
"additional": {
"prices": {
"min": 51,
"max": 180
}
},
"sku": null,
"isSync": true,
"attributeValues": {
"product-name": {
"type": "string",
"value": "product-name",
"isIcon": false,
"position": 0,
"additionalFields": {},
"isProductPreview": false
},
"price": {
"type": "integer",
"value": 51,
"isIcon": false,
"position": 1,
"additionalFields": {},
"isProductPreview": false
},
"currency_products": {
"type": "string",
"value": "usd",
"isIcon": false,
"position": 2,
"additionalFields": {},
"isProductPreview": false
},
"img": {
"type": "image",
"value": {
"size": 742690,
"filename": "files/project/product/2954/image/48853cbf-4462-42c6-8b99-d14f721c21a2.jpeg",
"contentType": "image/jpeg",
"previewLink": {
"default": [
"data:image/webp;base64,UklGRmwAAABXRUJQVlA4IGAAAADQAQCdASoQABAABUB8JbACdACZZ3P8AAD+wGsUXBs/r069WpdrcuaTNfVxqWIetuaIdIvOMkSp9iJRxE+KhA2YHbrVehhMRj/j5+DUdjWn1v5YtZ7vw0IgPi9R5vkAAAA=",
"https://your-project.oneentry.cloud/cloud-static/files/project/product/2954/image/48853cbf-4462-42c6-8b99-d14f721c21a2.preview.default.jpeg"
]
},
"downloadLink": "https://your-project.oneentry.cloud/cloud-static/files/project/product/2954/image/48853cbf-4462-42c6-8b99-d14f721c21a2.jpeg",
"defaultPreview": "default"
},
"isIcon": false,
"position": 3,
"additionalFields": {},
"isProductPreview": true
}
},
"categories": [
"catalog"
],
"rating": {},
"isVisible": true,
"moduleFormConfigs": [
{
"id": 12,
"formIdentifier": "review",
"moduleIdentifier": "catalog",
"isGlobal": false,
"isClosed": false,
"isModerate": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "catalog",
"isNested": true
}
],
"formDataCount": 688,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"2954": 688
},
"nestedEntityIdentifiers": [
"catalog"
],
"exceptionIds": []
}
],
"discountConfig": {}
}
],
"total": 1,
"totalFound": 1
}
Response schema
Schema: IProductsResponse
total: number
The total number of products found.
example: 100
items: IProductsEntity[]
An array of product entities.
example:
[
{
"id": 12345,
"title": "Product 1"
},
{
"id": 67890,
"title": "Product 2"
}
]
items.id: number
The unique identifier.
example: 12345
items.localizeInfos: ILocalizeInfo
The name of the products, taking into account localization.
example:
{}
items.statusIdentifier: string | null
Product page status identifiers (may be null).
example: "in_stock"
items.statusLocalizeInfos: ILocalizeInfo
Localized status name for the product.
example:
{ "title": "Sale" }
items.attributeSetIdentifier: string | null
Set of attributes id.
example: "set_12345"
items.position: number
Item number (for sorting).
example: 1
items.price: number | null
The value of the product page price taken from the index.
example: 150.00
items.additional: object
Additional value from the index.
example:
{
"prices": {
"min": 5,
"max": 150
}
}
items.sku: string | null
Product SKU (Stock Keeping Unit), may be null.
example: "SKU_12345"
items.isSync: boolean
Indication of page indexing.
example: true
items.attributeValues: IAttributeValues
Array of attribute values from the index, represented.
example:
[
{
"id": "color",
"value": "red"
}
]
items.categories: string[]
Product categories.
example:
[
1,
2,
3
]
items.isVisible: boolean
A sign of page visibility.
example: true
items.moduleFormConfigs: Array<IFormConfig>
Module form configurations (optional).
items.rating: IRating
Rating data.
items.isPositionLocked: boolean
Sorting position lock indicator (optional).
example: false
items.relatedIds: number[]
Ids of related product pages.
example:
[
12345,
67890
]
items.paymentStages: unknown
Payment stages data (may be null).
example: null
items.distance: number
Vector (semantic) search relevance distance. Present only in results of vector search.
example: 0.42
items.discountConfig: Record<string, unknown>
Discount configuration object.
example:
{}
items.templateIdentifier: string | null
User id of the linked template.
example: "template_12345"
items.shortDescTemplateIdentifier: string | null
User id of the linked template for a short description.
example: "short_desc_template_12345"
items.signedPrice: string
The signed price of the product is obtained along with the product data when signPrice is set.
see: Fixed product price
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
items.productPages: IProductPageRef[]
Array of product page references linking the product to its pages.
example:
[
{
"id": 16,
"pageId": 4,
"productId": 15,
"positionId": 244,
"categoryPath": "products"
}
]
items.blocks: string[]
Array of block identifiers.
example:
[
"block_12345",
"block_67890"
]
totalFound: number
Number of products matched before limits are applied; returned by block product endpoints (similarProducts, cart/wishlist recommendations, frequently ordered). Optional.
example: 2
🔒
signedPriceis the signed token that carries the locked price — pass it back when you create an order. See Fixed product price (signedPrice).