Skip to main content

getFrequentlyOrderedProducts

Get frequently ordered products by block marker and product ID.

Description​

Fetches the products most often ordered together with productId, for the given block. The response also includes fallbackUsed. If no products were ordered together with productId and the block is set to fall back to popular products, items holds popular products instead and fallbackUsed is true. The list can still be empty if there are no popular products either. Resolves to an IProductsResponse, not an array: the products are in items, the counts in total and totalFound.

.getFrequentlyOrderedProducts(

, , , ,

);

Parameters schema​

Schema

productId(required): number
Product ID.
example: 1

marker(required): string
Marker of the block.
example: "frequently_ordered_block"

langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"

signPrice: string
Marker of the order storage to fix prices for. When set, each product comes with a signedPrice that holds the price for a limited time.
see: Fixing the price

limit: number
Maximum number of products to return. When omitted, the block's own quantity setting applies.
example: 10

Examples​

Minimal example​

const response = await Blocks.getFrequentlyOrderedProducts(1, 'frequently_ordered_block');

Example with langCode​

const response = await Blocks.getFrequentlyOrderedProducts(1, 'frequently_ordered_block', 'en_US');

Example with limit​

const response = await Blocks.getFrequentlyOrderedProducts(1, 'frequently_ordered_block', 'en_US', undefined, 4);

limit caps the number of products returned. If you omit it, the block's quantity setting from the admin panel applies. See Limiting the number of products (limit).

Example response​

{
"items": [],
"total": 0,
"totalFound": 0,
"fallbackUsed": true
}

Response schema​

Schema: IProductsResponse

total: number
Total number of products found.
example: 100

items: IProductsEntity[]
Products in this response.
example:

[
{
"id": 12345,
"title": "Product 1"
},
{
"id": 67890,
"title": "Product 2"
}
]

items.id: number
ID of the product.
example: 12345

items.localizeInfos: ILocalizeInfo
Localized product data, such as the title.
example:

{}

items.statusIdentifier: string | null
Marker of the product status, or null.
example: "in_stock"

items.statusLocalizeInfos: ILocalizeInfo
Localized status name for the product.
example:

{ "title": "Sale" }

items.attributeSetIdentifier: string | null
Marker of the attribute set, or null if none is assigned.
example: "set_12345"

items.position: number
Position used for sorting. Present on catalog/list/ids//blocks entities; absent from vector (semantic) search results, so typed optional.
example: 1

items.price: number | null
Product price from the search index.
example: 150.00

items.additional: object
Extra values computed by the search index, such as the price range in prices.min and prices.max.
example:

{
"prices": {
"min": 5,
"max": 150
}
}

items.sku: string | null
Product SKU from the search index, or null.
example: "SKU_12345"

items.isSync: boolean
Whether the product's attribute index is up to date for the requested language. When false, an empty or partial attributeValues means the values are not published yet, not that there are none.
example: true

items.attributeValues: IAttributeValues
Attribute values keyed by attribute marker (an object, not an array).
example:

{
"product-name": {
"type": "string",
"value": "Split",
"position": 0
},
"price": {
"type": "integer",
"value": 150,
"position": 1
}
}

items.categories: string[]
URLs of the catalog pages the product belongs to.
example:

[
"catalog"
]

items.isVisible: boolean
Whether the product is visible.
example: true

items.moduleFormConfigs: Array<IFormConfig>
Form configurations of the module.

items.rating: IRating
Rating data: average value, likes and dislikes, and the calculation method.

items.isPositionLocked: boolean
Whether the sorting position is locked.
example: false

items.relatedIds: number[]
IDs of related products.
example:

[
12345,
67890
]

items.paymentStages: unknown
Payment stages of the product: an array of { title, value, marker } objects, or null when none are set.
example: null

items.distance: number
Relevance distance in vector (semantic) search. Present only in vector search results.
example: 0.42

items.discountConfig: Record<string, unknown>
Discount configuration.
example:

{}

items.templateIdentifier: string | null
Marker of the linked template.
example: "template_12345"

items.shortDescTemplateIdentifier: string | null
Marker of the template used for the short description.
example: "short_desc_template_12345"

items.signedPrice: string
Signed token (JWT) that fixes the product price for an order. Returned when signPrice is set.
see: Fixed product price
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

items.productPages: IProductPageRef[]
Links between the product and the catalog pages it belongs to.
example:

[
{
"id": 16,
"pageId": 4,
"productId": 15,
"positionId": 244,
"categoryPath": "products"
}
]

items.blocks: string[]
Markers of the blocks shown on the product page (not the blocks whose selection includes the product).
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

signedPrice is a signed token that carries the locked price. Pass it back when you create an order. See Fixed product price (signedPrice).