<?php
// Do not render if feature is disabled (also guarded in _toHtml)
if (!$block->isEnabled()) {
    return;
}

$priceData = $block->getPrice();

if (!is_array($priceData)) {
    return; // Product not found or invalid
}

if (isset($priceData['minPrice'])) {
    $price = number_format($priceData['minPrice'], 2);
} elseif (isset($priceData['price'])) {
    $price = number_format($priceData['price'], 2);
} else {
    return; // No usable price
}

$price = str_replace(",", "", $price);

$data = $block->getButtonData($price);

if (!$data) {
    return; // Price outside configured min/max range
}
?>
<?= $data; ?>