Ana içeriğe geç

getRepeatPurchase

Get products for repeat purchase.

Description

This method returns products the current context - an authorized user or a guest (resolved via the x-guest-id header, see Guest mode) - is likely to buy again, based on tracked user activity and purchase history. It returns a Promise that resolves to an array of IProductsEntity objects.

Blocks.getRepeatPurchase(

marker*, langCode, signPrice

);

Parameters schema

Schema

marker(required): string
Block marker
example: "repeat_purchase_block"

langCode: string
Language code. Default: "en_US"
example: "en_US"

signPrice: string
Sign price

Examples

Minimal example

const response = await Blocks.getRepeatPurchase('repeat_purchase_block');

Example with attributes

const response = await Blocks.getRepeatPurchase('repeat_purchase_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