Home > widget-integration > TierDiscountModule > connectWidget

TierDiscountModule.connectWidget() method

Connects the widget controller to the DOM element. Override this method to customize widget connection parameters or add pre-connection logic.

Signature:

protected connectWidget(widget: TierDiscountWidgetController, block: AppBlock): Promise<void>;

Parameters

Parameter

Type

Description

widget

TierDiscountWidgetController

The widget controller instance

block

AppBlock

The AppBlock instance

Returns:

Promise<void>

Promise that resolves when the widget connection is complete

Example

// Add custom widget connection parameters protected async connectWidget(widget, block) { const customParams = { widgetId: this.parseWidgetId(block.id), shopTheme: this.getShopTheme(), }; widget.connect(customParams, block.document); }