Home > widget-integration > TierDiscountModule

TierDiscountModule class

Module for tier discount bundle widgets.

Integrates tier discount functionality into the TAE framework, providing: - Automatic widget initialization from Shopify blocks - Dependency injection for all services - Lazy loading of widgets - Extensibility for shop-specific customizations

Technical Support teams can extend this module to customize initialization or add shop-specific services to the dependency injection container.

Signature:

export declare class TierDiscountModule 

Example

Extend to add custom initialization logic:

@Module({
  imports: [TierDiscountModule],
  providers: [CustomTierDiscountService],
})
class CustomTierDiscountModule extends TierDiscountModule {
  protected setupBlockListener() {
    this.appService.TAEApp.addRegistryBlockListener((block) => {
      if (block.blockType === 'tierDiscount' || block.blockType === 'custom-tier') {
        this.onInitBlock(block);
      }
    });
  }
}

Constructors

Constructor

Modifiers

Description

(constructor)(moduleRef, appService)

Constructs a new instance of the TierDiscountModule class

Properties

Property

Modifiers

Type

Description

appService

protected

AppService

moduleRef

protected

ModuleRefImpl

Methods

Method

Modifiers

Description

connectWidget(widget, block)

protected

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

handleBlockInitError(error, block)

protected

Handles errors during block initialization. Override this method to customize error handling, reporting, or recovery logic.

initializeForSearchPage(container)

static

Initializes tier discount widget on search page Called from tier-discount-search.helper.ts

onInitBlock(block)

protected

Called when a tier discount block is initialized. Override this method to customize widget initialization or add shop-specific setup logic.

parseWidgetId(blockId)

protected

Parses the widget ID from the block ID. Override this method to customize widget ID extraction logic for different shops or naming conventions.

setupBlockListener()

protected

Sets up the TAE App block listener for tier discount widgets. Override this method to customize block registration logic or support additional block types.