Magento 2 checkout page order summary add on checkout/index/index

checkoutmagento2

I need to show the order summary in both the checkout pages i.e. when you will go to below URLs after adding a product in the cart in a default Magento 2 setup:

  1. localhost/magento216/checkout/
  2. localhost/magento216/checkout/#payment

you can check that the order summary in the first URL doesn't contains the order totals block. Please check the screenshot for help.

What I want is to add the order total in localhost/magento216/checkout/ similarly working on localhost/magento216/checkout/#payment

Thanks in Advance !!!

Checkout

enter image description here

Checkout#payment

enter image description here

Best Answer

Finally achieved it...

Go to file path - \vendor\magento\theme-frontend-luma\Magento_Checkout\layout\checkout_index_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="checkout.root">
        <arguments>
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                    <item name="checkout" xsi:type="array">
                        <item name="children" xsi:type="array">
                            <item name="steps" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="shipping-step" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="shippingAddress" xsi:type="array">
                                                <item name="children" xsi:type="array">
                                                    <item name="before-shipping-method-form" xsi:type="array">
                                                        <item name="children" xsi:type="array">
                                                            <item name="shipping_policy" xsi:type="array">
                                                                <item name="component" xsi:type="string">Magento_Shipping/js/view/checkout/shipping/shipping-policy</item>
                                                                <item name="component" xsi:type="string">Magento_Checkout/js/view/cart/shipping-rates</item>
                                                                <item name="component" xsi:type="string">Magento_Checkout/js/view/cart/shipping-estimation</item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>

                            <item name="sidebar" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="summary" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="block-totals" xsi:type="array">
                                                <item name="component" xsi:type="string">Magento_Checkout/js/view/cart/totals</item>
                                                <item name="displayArea" xsi:type="string">totals</item>
                                                <item name="config" xsi:type="array">
                                                    <item name="template" xsi:type="string">Magento_Checkout/cart/totals</item>
                                                </item>
                                                <item name="children" xsi:type="array">
                                                    <!-- sort order for this totals is configured on admin panel-->
                                                    <!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order -->
                                                    <item name="subtotal" xsi:type="array">
                                                        <item name="component"  xsi:type="string">Magento_Checkout/js/view/summary/subtotal</item>
                                                        <item name="config" xsi:type="array">
                                                            <item name="title" xsi:type="string" translate="true">Subtotal</item>
                                                            <item name="template" xsi:type="string">Magento_Checkout/cart/totals/subtotal</item>
                                                        </item>
                                                    </item>
                                                    <item name="shipping" xsi:type="array">
                                                        <item name="component"  xsi:type="string">Magento_Checkout/js/view/cart/totals/shipping</item>
                                                        <item name="config" xsi:type="array">
                                                            <item name="title" xsi:type="string" translate="true">Shipping</item>
                                                            <item name="template" xsi:type="string">Magento_Checkout/cart/totals/shipping</item>
                                                        </item>
                                                    </item>
                                                    <item name="grand-total" xsi:type="array">
                                                        <item name="component"  xsi:type="string">Magento_Checkout/js/view/summary/grand-total</item>
                                                        <item name="config" xsi:type="array">
                                                            <item name="title" xsi:type="string" translate="true">Order Total</item>
                                                            <item name="template" xsi:type="string">Magento_Checkout/cart/totals/grand-total</item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
</body>

Happy Coding !!! :)

Related Topic