Home > widget-integration > TierDiscountWidgetController

TierDiscountWidgetController class

Signature:

export declare class TierDiscountWidgetController extends Controller 

Extends: Controller

Constructors

Constructor

Modifiers

Description

(constructor)(appService, tierDiscountService, cartService, tierDiscountAPI, cartController)

Constructs a new instance of the TierDiscountWidgetController class

Properties

Property

Modifiers

Type

Description

_changeQtyTimer

protected

NodeJS.Timeout | null

_lastUiSignature

protected

string

_syncDebounceTimer

protected

NodeJS.Timeout | null

appService

protected

AppService

bundleRequestMap

protected

static

readonly

Map<string, Promise<any>>

cartController

protected

CartController

cartService

protected

CartService

debouncedChangeQuantity

protected

(variantId: string, quantity: number) => void

state

Signal<{ loading: boolean; model: TierDiscountModel | null; }>

syncWithCart

protected

() => Promise<void>

tierDiscountAPI

protected

TierDiscountAPI

tierDiscountService

protected

TierDiscountService

updateUIData

protected

(cart: any) => void

Methods

Method

Modifiers

Description

applySmartPricing(data)

protected

calculateDiscountedTotal(model, totalQty, originalCents)

protected

connect(props, parent)

debounce(func, wait)

protected

debouncedSyncWithCart()

protected

formatMilestoneLabels(model, rate)

protected

formatProductPrices(model)

protected

getDecreaseButtonIcon(quantity)

protected

getLocale()

protected

getProductId()

protected

getVariantDisplayTitle(item)

protected

hasOnlyDefaultTitleVariant(productId)

protected

hideArrowForSingleDefaultVariants(container)

protected

Hides the chevron SVG on the Add button for products that have only a single "Default Title" variant — clicking the button adds immediately without needing a dropdown, so the arrow indicator is misleading.

initModal(model)

protected

navigateWithLocale(href)

protected

Navigates to a product URL with locale-aware path building. Matches the behaviour of handleClickTagAItemBuildUrlWithLocale used by the classic bundle.

refreshDiscountStatus(model, totalQty, totalOriginalCents)

protected

registerTierEvents(container)

protected

renderAddedVariantList(productId, variantsInCart)

protected

safeInitWidget(widgetId, container)

protected

safeSetHTML(container, htmlContent)

protected

Safely set HTML content to avoid XSS vulnerabilities

syncModalState(model, relevantItems)

protected

updateCheckoutButtonState(totalQty)

protected

updateModalFooter(discountedTotal, originalTotal, hasDiscount)

protected

updatePriceSummaryUI(totalQty, originalCents, totalCents, hasDiscount, items)

protected