Update cookies preferences

How to get Price Ranges for Configurable Bundle Products

In this example, we are retrieving the bundle product itself through an observer In Magento 2.

If you need to know how to get price ranges for configurable bundle products in Magento 2 when indexing into Algolia - then this article is for you.

In this example, we are retrieving the bundle product itself through an observer. But however you get a reference to the product, as long as it's an instance of Magento\Catalog\Model\Product, then the below code will work.

Firstly you will need to use some existing Magento classes and add them to your constructor function:


And then the code to retrieve the min and max prices for the bundle and create the price range string looks like:

You then have your price range string ($formattedPriceRange)

If you enjoyed this article, read our other Learn articles to see more from our Magento developers or browse the site to see what else we do with Adobe Commerce, PunchOut Catalog and more.

Do you need support from our Magento certified professionals?


...
Ian

share:

Ready to start your next project?

See how we can help you accelerate your business