Home > widget-integration > CartDrawerRecommendationController > updateProductPrice

CartDrawerRecommendationController.updateProductPrice() method

Update the product price when variant changes. Override to customize price update behavior.

Uses the local formatPrice() method for consistent price formatting across all recommendation widgets, including currency code display based on cart settings.

Signature:

protected updateProductPrice(productItem: HTMLElement, price: string): void;

Parameters

Parameter

Type

Description

productItem

HTMLElement

The product item container element

price

string

The price value (may be formatted string or raw number string)

Returns:

void

Example

Override to show compare-at price alongside variant price:

protected updateProductPrice(productItem: HTMLElement, price: string) {
  super.updateProductPrice(productItem, price);
  const comparePrice = productItem.querySelector('.boost-sd__rcu-item-compare-price');
  if (comparePrice) {
    comparePrice.style.display = 'inline';
  }
}