<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
?>

<?php
$idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
/** @var \Magento\Bundle\Pricing\Render\FinalPriceBox $block */

/** @var \Magento\Bundle\Pricing\Price\FinalPrice $finalPriceModel */
$finalPriceModel = $block->getPrice();
$minimalPrice = $finalPriceModel->getMinimalPrice();
$maximalPrice = $finalPriceModel->getMaximalPrice();
/** ex: \Magento\Bundle\Pricing\Price\BundleRegularPrice */
/** @var \Magento\Framework\Pricing\Price\PriceInterface $regularPriceModel */
$regularPriceModel = $block->getPriceType('regular_price');
$maximalRegularPrice = $regularPriceModel->getMaximalPrice();
$minimalRegularPrice = $regularPriceModel->getMinimalPrice();
$regularPriceAttributes = [
    'display_label'     => __('Regular Price'),
    'price_id'          => $block->getPriceId('old-price-' . $idSuffix),
    'include_container' => true,
    'skip_adjustments'  => true
];
$renderMinimalRegularPrice = $block->renderAmount($minimalRegularPrice, $regularPriceAttributes);
?>
<?php if ($block->getSaleableItem()->getPriceView()) : ?>
    <p class="minimal-price">
        <?= /* @noEscape */ $block->renderAmount($minimalPrice, [
            'display_label'     => __('As low as'),
            'price_id'          => $block->getPriceId('from-'),
            'include_container' => true
        ]); ?>
        <?php if ($minimalPrice < $minimalRegularPrice) : ?>
            <span class="old-price">
                <?= /* @noEscape */ $renderMinimalRegularPrice ?>
            </span>
        <?php endif ?>
    </p>
<?php else : ?>
    <?php if ($block->showRangePrice()) : ?>
        <p class="price-from">
            <?= /* @noEscape */ $block->renderAmount($minimalPrice, [
                'display_label'     => __('From'),
                'price_id'          => $block->getPriceId('from-'),
                'price_type'        => 'minPrice',
                'include_container' => true
            ]); ?>
            <?php if ($minimalPrice < $minimalRegularPrice) : ?>
                <span class="old-price">
                    <?= /* @noEscape */ $renderMinimalRegularPrice ?>
                </span>
            <?php endif ?>
        </p>
        <p class="price-to">
            <?= /* @noEscape */ $block->renderAmount($maximalPrice, [
                'display_label'     => __('To'),
                'price_id'          => $block->getPriceId('to-'),
                'price_type'        => 'maxPrice',
                'include_container' => true
            ]); ?>
            <?php if ($maximalPrice < $maximalRegularPrice) : ?>
                <span class="old-price">
                    <?= /* @noEscape */ $block->renderAmount($maximalRegularPrice, $regularPriceAttributes); ?>
                </span>
            <?php endif ?>
        </p>
    <?php else : ?>
        <?= /* @noEscape */ $block->renderAmount($minimalPrice, [
            'price_id'          => $block->getPriceId('product-price-'),
            'include_container' => true
        ]); ?>
        <?php if ($minimalPrice < $minimalRegularPrice) : ?>
            <span class="old-price">
                <?= /* @noEscape */ $renderMinimalRegularPrice ?>
            </span>
        <?php endif ?>
    <?php endif ?>
<?php endif ?>
