3

In my custom theme i do not use discount form. In cart, I removed via xml and it works. But in checkout I can't remove it via xml.

How i can remove discount form in onepage checkout?

4

To disable the component in your checkout_index_index.xml, we can use the following instructions:

<item name="%the_component_to_be_disabled%" xsi:type="array">
    <item name="config" xsi:type="array">
        <item name="componentDisabled" xsi:type="boolean">true</item>
    </item>
</item>

Read more: http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_customize.html#disable-a-component

app/code/Vendor/Checkout/view/layout/checkout_index_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.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="billing-step" xsi:type="array">
                                            <item name="component" xsi:type="string">uiComponent</item>
                                            <item name="children" xsi:type="array">
                                                <item name="payment" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="afterMethods" xsi:type="array">
                                                            <item name="children" xsi:type="array">
                                                                <!--Disable Discount here-->
                                                                <item name="discount" xsi:type="array">
                                                                    <item name="config" xsi:type="array">
                                                                        <item name="componentDisabled" xsi:type="boolean">true</item>
                                                                    </item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

We can remove a component from layout rendering via Plugin also.

| improve this answer | |
  • It doesn't work for me. I put the code from <referenceBlock> inside the <body> tag as one of <referenceBlock>s , I have even tried to flush cache and deploy static. What have I done wrong? – hln Jan 8 '18 at 9:15
0

Remove the Apply Coupon Code Field at the checkout & cart page in Magento 2.3

step 1 : Remove from checkout/cart demo => http://abc/checkout/cart/ GO with your child theme file path

app/design/frontend/Smartwave/porto_child/Magento_Theme/layout/default.xml

simply write below line

<referenceBlock name="checkout.cart.coupon" remove="true"/>

or else go with another below path :

app/design/frontend/Smartwave/porto_child/Magento_Checkout/layout/checkout_cart_index.xml

simply write same line

<referenceBlock name="checkout.cart.coupon" remove="true"/>

step 2 : Remove from checkout/payment => http://abc/checkout/#payment

copy this file from your vendor/magento/module-salesrule/view/frontend/layout/checkout_index_index.xml

Overwrite above vendor file to your child theme :

app/design/frontend/Smartwave/porto_child/Magento_SalesRule/layout/checkout_index_index.xml

find this code (line no approx :24) in your file.

<item name="discount" xsi:type="array">

Now removed item discount by below code. You need to simply put this lines

   <item name="config" xsi:type="array">
       <item name="componentDisabled" xsi:type="boolean">true</item>
   </item>

done...

| 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.