Chat on WhatsApp

What's the cleanest way to add a Plugin around Product::getPrice in Magento 2.4?

Wire it in etc/di.xml against Magento\Catalog\Pricing\Price\FinalPricenot Product::getPrice. Catalog price uses the price-pool pattern since 2.2: Product::getPrice returns the base attribute value, but the storefront and cart call FinalPrice via the price-info object. Plugin signature: around aroundGetValue(FinalPrice $subject, callable $proceed). Always call $proceed() first, mutate the float, return it — never short-circuit, or you break tier prices and catalog rules. Sample di.xml:

<type name="Magento\Catalog\Pricing\Price\FinalPrice">
  <plugin name="vendor_module_final_price" type="Vendor\Module\Plugin\FinalPricePlugin"/>
</type>
Was this helpful?