Skip to content

Magento 2.4.3 – shiping chekout box

I’m trying to get the customer to choose the shipping because many people just continue without checking the shipping method. We need it to not already be checked and requited. What do I need to change on this file?
method.phtml

<?php

?>

    <?php if ($groups = $block->getShippingRateGroups()): ?>
        <?php $currentRate = $block->getCurrentShippingRate(); ?>
        <?php foreach ($groups as $code => $rates): ?>
            <?php if (0): ?><strong><?php echo $block->escapeHtml($block->getCarrierName($code)) ?></strong><?php endif; ?>
            <?php foreach ($rates as $rate):
                $value = $block->escapeHtml($block->renderShippingRateValue($rate));
                $checked = $currentRate === $rate->getCode() ? 'checked' : '';
                ?>
                <div class="xxx-checkout-radio-row">
                    <span>
                        <input type="radio"
                               name="shipping_method" <?php echo $checked; ?> value="<?php echo $value; ?>"
                               id="<?php echo $value; ?>">
                        <label for="<?php echo $value; ?>">
                            <?php /* @noEscape */
                            echo $block->renderShippingRateOption($rate); ?>
                        </label>
                    </span>
                </div>
            <?php endforeach; ?>
        <?php endforeach; ?>

    <?php else: ?>
        <p>
            <strong>
                <?php echo $block->escapeHtml(__('Sorry, no quotes are available for this order right now.')); ?>
            </strong>
        </p>
    <?php endif; ?>
</div>