0

We need to display the shipping amount to static text "TBD" To be decided. I have narrow down to this file vendor/magento/module-sales/Block/Order/Totals.php Line no:124

if (!$source->getIsVirtual() && ((double)$source->getShippingAmount() || $source->getShippingDescription())) {
        $this->_totals['shipping'] = new \Magento\Framework\DataObject(
            [
                'code' => 'shipping',
                'field' => 'shipping_amount',
                //'value' => $this->getSource()->getShippingAmount(),
                'value' => 'TBD',
                'label' => __('Shipping & Handling'),
            ]
        );
    }

But this not work. can anyone have the Idea enter image description here

1

You can override this file in your custom theme.

vendor/magento/module-sales/view/frontend/templates/order/totals.phtml

here

app/design/frontend/Vendor/Theme/Magento_Sales/view/frontend/templates/order/totals.phtml

And update content like this ..

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

/**
 * @var $block \Magento\Sales\Block\Order\Totals
 * @see \Magento\Sales\Block\Order\Totals
 */
?>
<?php foreach ($block->getTotals() as $_code => $_total) : ?>
    <?php if ($_total->getBlockName()) : ?>
        <?= $block->getChildHtml($_total->getBlockName(), false) ?>
    <?php else :?>
    <tr class="<?= $block->escapeHtmlAttr($_code) ?>">
        <th <?= /* @noEscape */ $block->getLabelProperties() ?> scope="row">
            <?php if ($_total->getStrong()) : ?>
                <strong><?= $block->escapeHtml($_total->getLabel()) ?></strong>
            <?php else : ?>
                <?= $block->escapeHtml($_total->getLabel()) ?>
            <?php endif ?>
        </th>
        <?php if($_code == 'shipping'): ?>
            <td <?= /* @noEscape */ $block->getValueProperties() ?> data-th="<?= $block->escapeHtmlAttr($_total->getLabel()) ?>">
                <?php echo "TBD"; ?>
            </td>
        <?php else: ?>
            <td <?= /* @noEscape */ $block->getValueProperties() ?> data-th="<?= $block->escapeHtmlAttr($_total->getLabel()) ?>">
                <?php if ($_total->getStrong()) : ?>
                    <strong><?= /* @noEscape */ $block->formatValue($_total) ?></strong>
                <?php else : ?>
                    <?= /* @noEscape */ $block->formatValue($_total) ?>
                <?php endif?>
            </td>
        <?php endif; ?>
    </tr>
    <?php endif; ?>
<?php endforeach?>

Hope this will help you!

  • Thanks Buddy, for appreciation!! :) Happy to help you. – Kishan Savaliya Oct 21 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.