Skip to content

product.priceChanged

product.priceChanged is an event on the Event Bus that occurs whenever the product price changes.

Event body

Body of product.priceChanged event has a TProductPriceChangedEventBody type which represents the details of a changed price. It is optional so it might not exist.

Example

In this example we listen to product.priceChanged event and perform an action whenever it's emitted.

useStorefront(async (storefront) => {
    storefront.eventBus.on('product.priceChanged', ({ body: changedPrice }) => {
        console.log('A price has changed', changedPrice);
    });
});