0

How to remove Default Grand Total from View Order Page Backend.

As I have added new Grand Total and Modified Existing once, now I have to remove Core Magento Grand Total and Set my Customize Grand Total.

Please check Attachment also.

enter image description here

  • Can you please elaborate more about your requirement. As i have checked i don't have 2 times Grand Total option on my magento. my.jetscreenshot.com/demo/20190918-cezq-16kb.jpg – Oscprofessionals Sep 18 '19 at 12:50
  • the first grand total is custom that i need .. i want to remove second one that is by default – Junaid Ashfaq Sep 18 '19 at 12:52
  • I Think this is not the way to override the Amount, First you have to Override the Amount of Grand Total with the proper way of Magento. If you Use this way, then you break many things like, Shipping, Invoices, Credit Memos and Shipment also. – Oscprofessionals Sep 18 '19 at 12:54
0

As mentioned in How to override Adminhtml template files in Magento 2.3?

Put below content in your total.phtml file

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

// @codingStandardsIgnoreFile

?>

<table class="data-table admin__table-secondary order-subtotal-table">
    <?php $_totals = $block->getTotals('footer')?>

    <?php if ($_totals):?>
        <tfoot>
            <?php foreach ($block->getTotals('footer') as $_code => $_total): ?>
                <?php if ($_total->getBlockName()): ?>
                    <?= $block->getChildHtml($_total->getBlockName(), false) ?>
                <?php else:?>
                    <?php 
                    if (strpos($_SERVER['REQUEST_URI'], "/admin/sales/order/view/order_id") !== false) {
                        if ($_code != 0) { ?>
                            <tr class="col-<?= /* @escapeNotVerified */ $_code ?>">
                                <td <?= /* @escapeNotVerified */ $block->getLabelProperties() ?> class="label">
                                    <strong><?= $block->escapeHtml($_total->getLabel()) ?></strong>
                                </td>
                                <td <?= /* @escapeNotVerified */ $block->getValueProperties() ?>>
                                    <strong><?= /* @escapeNotVerified */ $block->formatValue($_total) ?></strong>
                                </td>
                            </tr>
                    <?php } else { ?>
                        <tr class="col-<?= /* @escapeNotVerified */ $_code ?>">
                            <td <?= /* @escapeNotVerified */ $block->getLabelProperties() ?> class="label">
                                <strong><?= $block->escapeHtml($_total->getLabel()) ?></strong>
                            </td>
                            <td <?= /* @escapeNotVerified */ $block->getValueProperties() ?>>
                                <strong><?= /* @escapeNotVerified */ $block->formatValue($_total) ?></strong>
                            </td>
                        </tr>
                    <?php } ?>
                <?php endif?>
            <?php endforeach?>
        </tfoot>
    <?php endif?>

    <?php $_totals = $block->getTotals('')?>
    <?php if ($_totals):?>
        <tbody>
            <?php foreach ($_totals as $_code => $_total): ?>
                <?php if ($_total->getBlockName()): ?>
                    <?= $block->getChildHtml($_total->getBlockName(), false) ?>
                <?php else:?>
                    <tr class="col-<?= /* @escapeNotVerified */ $_code ?>">
                        <td <?= /* @escapeNotVerified */ $block->getLabelProperties() ?> class="label">
                            <?php if ($_total->getStrong()):?>
                            <strong><?= $block->escapeHtml($_total->getLabel()) ?></strong>
                            <?php else:?>
                            <?= $block->escapeHtml($_total->getLabel()) ?>
                            <?php endif?>
                        </td>

                        <?php if ($_total->getStrong()):?>
                            <td <?= /* @escapeNotVerified */ $block->getValueProperties() ?>>
                                <strong><?= /* @escapeNotVerified */ $block->formatValue($_total) ?></strong>
                            </td>
                        <?php else:?>
                            <td <?= /* @escapeNotVerified */ $block->getValueProperties() ?>>
                                <span><?= /* @escapeNotVerified */ $block->formatValue($_total) ?></span>
                            </td>
                        <?php endif?>
                    </tr>
                <?php endif?>
            <?php endforeach?>
        </tbody>
    <?php endif?>
</table>

Hope it helps!!!

| improve this answer | |

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.