Skip to main content
2 of 2
added 1843 characters in body
Noemi Quezada
  • 1.1k
  • 5
  • 18
  • 36

Magento 2 Discount Rule does not show Default Rule Label

I set up a Cart Price Rule that gives 30% discount. The 30% discount is given to the order, however, it displays "Discount" instead of the Default Rule Label specified.

Cart Price Rule Setup

The following is details to the Rule I added: enter image description here enter image description here enter image description here enter image description here

Frontend

Even though the labels were set, it shows Discount in the front end enter image description here

Edit:

With more research I saw that the variable "Discount" is passed to the Knockout JS discount.html template instead of the Discount Description.

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

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.cart.totals">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="block-totals" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="before_grandtotal" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <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>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>
Noemi Quezada
  • 1.1k
  • 5
  • 18
  • 36