Home > widget-integration > TierDiscountService > validateTierDiscountWidget
TierDiscountService.validateTierDiscountWidget() method
Validates whether a tier discount bundle should be rendered.
Checks: - Widget configuration exists - Current page context matches widget settings - Bundle has valid products - Bundle has valid discount tiers
Signature:
validateTierDiscountWidget(widgetId: string): boolean;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
widgetId |
string |
The widget identifier to validate |
Returns:
boolean
True if bundle should be rendered
Example
if (this.validateTierDiscountWidget('bundle-828365')) {
const model = await this.getTierDiscountModel('bundle-828365');
await this.renderWidget(model);
}