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 array of IProductsEntity objects.
Blocks.getCartComplement(
marker*,
langCode,
signPrice
);
Parameters schema
Schema
marker(required): string
Block marker
example: "cart_complement_block"
langCode: string
Language code. Default: "en_US"
example: "en_US"
signPrice: string
Sign price
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 response
[
{
"id": 1764,
"localizeInfos": {
"title": "Product"
},
"price": 100,
"additional": {
"prices": {
"min": 0,
"max": 100
}
},
"isVisible": true,
"isSync": true,
"sku": "0-123",
"attributeValues": {},
"attributeSetIdentifier": "my-set",
"statusIdentifier": "in_stock",
"statusLocalizeInfos": {
"title": "In stock"
},
"position": 1
}
]
Response schema
Schema: IProductsEntity[]
[]: IProductsEntity
A product entity.
[].id: number
The unique identifier.
example: 12345
[].localizeInfos: ILocalizeInfo
The localized name of the product.
example: { "title": "Product" }
[].price: number | null
The product page price taken from the index.
example: 100
[].sku: string | null
Product SKU (Stock Keeping Unit), may be null.
example: "SKU_12345"
[].attributeValues: IAttributeValues
Array of attribute values from the index.
[].statusIdentifier: string | null
Product page status identifier (may be null).
example: "in_stock"
[].isVisible: boolean
A sign of page visibility.
example: true
[].position: number
Item number (for sorting).
example: 1