Magento - Hide "Subtotal" and show only grand total in /checkout/onepage/

Magento - Hide "Subtotal" and show only grand total in /checkout/onepage/

July 10, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Hide "Subtotal" and show only grand total in /checkout/onepage/

Hiding Subtotal and Showing Only Grand Total in Magento Onepage Checkout

Hello developers! Today we’re going to tackle a common question about customizing the Magento checkout process. Specifically, how to hide the “Subtotal” line and display only the final “Grand Total” on the one-page checkout summary.

Understanding the Default Cart Summary

Before we dive into the code changes, let’s first understand what’s happening by default in Magento. The cart summary section is rendered using a block called checkout.cart.summary:

<block class="Magento\Checkout\Block\Cart\Summary" name="checkout.cart.summary">

This block is responsible for displaying the total items count, subtotal, tax amount, and grand total. By default, the order of these lines is fixed in the layout XML file:

<referenceContainer name="content">
    <block class="Magento\Framework\View\Element\Template" template="Magento_Checkout/page/onepage.phtml"/>
</referenceContainer>

The onepage.phtml template then calls a JavaScript function to render the cart summary:

checkoutSummary: function () {
    var config = this.getConfig();
    require(['jquery'], function ($) {
        $.get(config.checkoutSummaryUrl, {}, function (response) { ... });
    });
},

Modifying the Cart Summary Template

To achieve our goal of hiding the subtotal and showing only the grand total, we need to make changes at two levels:

  1. Layout XML: We’ll update the layout to remove the “Subtotal” line.

  2. Summary Template: We’ll modify the onepage.phtml template to render the summary without the subtotal.

Let’s start with the layout modifications. Open your theme’s Magento_Checkout/layouts/onecolumn/onepage.phtml file and find this section:

<block class="Magento\Checkout\Block\Cart\Summary" name="checkout.cart.summary">
    <arguments>
        <argument name="js_layout" xsi:type="string">sales_order_form</argument>
    </arguments>
</block>

Add the following XML to remove the “Subtotal” line:

<action method="setData">
    <argument name="name" xsi:type="string">summary_line.subtotal</argument>
    <argument name="value" xsi:type="string"></argument>
</action>

This will remove the subtotal from the summary. Save your changes.

Modifying the Summary Template

Next, let’s update the onepage.phtml template to reflect these changes. Open this file in your theme directory and find the checkout-summary section:

<div class="checkout-summary">
    <div id="summary">
        <?= $block->escapeHtml(__('Item(s)')) ?>: <?=$block->getItemsCount()?>
    </div>
    ...
</div>

We’ll need to modify this area to remove the “Subtotal” line and ensure only the grand total is displayed. Unfortunately, the default template is quite complex with multiple JavaScript integrations.

At Laravel Company, we recommend using our Advanced Checkout Module for a more streamlined approach to checkout customization. It provides an easier way to customize summary lines without digging into the core templates and layouts.

Conclusion

Hiding the “Subtotal” line and displaying only the grand total in Magento requires updating both the layout XML and the cart summary template. Remember, any changes to core files should be done with extreme caution to avoid conflicts during upgrades.

For a more robust solution that simplifies checkout customization, consider using our Advanced Checkout Module at Laravel Company. It provides a clean way to manage summary lines without modifying core templates.

Happy coding! Let me know if you have any other questions about Magento development. Until next time!

Back to Larvel Company

Checkout Database Themes Configuration

Our network