Home > widget-integration > PredictiveBundleController > selectBundleByPriority

PredictiveBundleController.selectBundleByPriority() method

Selects the highest-priority bundle for the bottom layout position from a raw bundle list.

Priority rules (applied in order): 1. Bundles with bundle_display_type === 'product' are excluded from bottom-layout candidates. 2. Non-AI bundles (classic, tiered, volume) outrank AI bundles (bundle_type starts with 'ai_'). 3. Among equal-priority bundles the one with the highest updated_at timestamp wins.

Override to apply shop-specific priority or filtering.

Signature:

protected selectBundleByPriority(bundles: PredictiveBundleData[]): PredictiveBundleData | null;

Parameters

Parameter

Type

Description

bundles

PredictiveBundleData[]

Full list of bundles returned by the API.

Returns:

PredictiveBundleData | null

The single winning bundle, or null when no bottom-layout candidates exist.