Home > widget-integration > RecommendationWidgetController > updateTotalPriceUI
RecommendationWidgetController.updateTotalPriceUI() method
Updates the total price display in the bundle widget UI.
Refreshes the visual display of the total bundle price and updates accessibility attributes. Override this method to customize price display formatting, add additional UI elements, or implement custom accessibility features.
Signature:
updateTotalPriceUI(totalPrice: number, container: HTMLElement): void;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
totalPrice |
number |
The calculated total price value in cents |
|
container |
HTMLElement |
The HTML element containing the widget and price display elements |
Returns:
void
Remarks
This method automatically formats the price using the shop's currency settings and updates both the visual display and ARIA labels for accessibility.
Example
Override to add savings display:
public updateTotalPriceUI(totalPrice: number, container: HTMLElement): void {
super.updateTotalPriceUI(totalPrice, container);
// Calculate and display savings
const originalTotal = this.calcOriginalTotal();
const savings = originalTotal - totalPrice;
if (savings > 0) {
const savingsElement = container.querySelector('.bundle-savings');
if (savingsElement) {
savingsElement.textContent = `Save ${this.formatPrice(savings)}`;
}
}
}