php - How do I display the price of selected bundle products instead of the highest possible price?

one text

I have a bundle product consisting of 6 products. Some of these are variable products with a default value picked. The price is correctly shown on the product page but on the category page (shop loop) the price shows the maximum price available and not the actual price of the default selection.

Since the price is correctly shown on the product page it should be possible to do the same on the shop loop?

I've recorded a short video of the issue: https://www.awesomescreenshot.com/video/10704837?key=291f103a39650becb7f185694534246c

here's the code that makes it show the max price:

/**
                 * 'woocommerce_bundle_force_old_style_price_html' filter.
                 *
                 * Used to suppress the range-style display of bundle price html strings.
                 *
                 * @param  boolean            $force_suppress_range_format
                 * @param  WC_Product_Bundle  $this
                 */
                if ( $suppress_range_price_html || apply_filters( 'woocommerce_bundle_force_old_style_price_html', false, $this ) ) {

                    $price = wc_price( $price_max );

                    $regular_price_min = $this->get_bundle_regular_price( 'max', true );

                    if ( $regular_price_min !== $price_max ) {

                        $regular_price = wc_price( $regular_price_max );

                        if ( $price_min !== $price_max ) {
                            $price = sprintf( _x( '%1$s%2$s', 'Price range: from', 'woocommerce-product-bundles' ), wc_get_price_html_from_text(), wc_format_sale_price( $regular_price, $price ) . $this->get_price_suffix() );
                        } else {
                            $price = wc_format_sale_price( $regular_price, $price ) . $this->get_price_suffix();
                        }

Source