6

I have created 10%off cart rule and then applied it.

It's applying correctly but Discount Label and Amount are not showing in checkout cart.

enter image description here

** UPDATE **

When I'm changing my theme to default luma then

Discount is showing.(Below Image)

enter image description here

What to do to show that row?

2 Answers 2

11

/vendor/magento/module-sales-rule/view/frontend/layout/checkout_cart_index.xml

Take below code from above file

<item name="discount" xsi:type="array">
   <item name="component" xsi:type="string">Magento_SalesRule/js/view/cart/totals/discount</item>
   <item name="config" xsi:type="array">
    <item name="title" xsi:type="string" translate="true">Discount</item>
   </item>
</item>

Insert it in checkout_cart_index.xml file of Magento_checkout in your theme by Overriding it there.

Now you can see discount there.

11
  • what will be the location of this file with name checkout_cart_index.xml Commented Nov 17, 2017 at 9:54
  • I am asking about the location of that place where i need to put this code, that is where in my theme? Commented Nov 17, 2017 at 10:36
  • Do we need to override the same file from where we copied this code or somewhere else? Because it is not working with the same file Commented Nov 17, 2017 at 10:42
  • I have created a file at location magento_root\app\design\frontend\Theme_package\theme\Magento_SalesRule\layout\checkout_cart_index.xml but it is not working with it Commented Nov 17, 2017 at 11:26
  • @Miroslav Due to your edit, solution is not understandable. Commented Nov 17, 2017 at 11:33
1

Complete code of app/design/frontend/theme_package/theme_name/Magento_Checkout/layout/checkout_cart_index.xml file

                  <container name="checkout.cart.totals.container" as="totals" label="Shopping Cart Totals">
                        <block class="Magento\Checkout\Block\Cart\Totals" name="checkout.cart.totals" template="Magento_Checkout::cart/totals.phtml">
                            <arguments>
                                <argument name="jsLayout" xsi:type="array">
                                    <item name="components" 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">
                                                <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="discount" xsi:type="array">
                                                    <item name="component" xsi:type="string">Magento_SalesRule/js/view/cart/totals/discount</item>
                                                    <item name="config" xsi:type="array">
                                                        <item name="title" xsi:type="string" translate="true">Discount</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">Estimated Total</item>
                                                        <item name="template" xsi:type="string">Magento_Checkout/cart/totals/grand-total</item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </argument>
                            </arguments>
                        </block>
                    </container>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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