0

I want to add third party JS code and HTML on the checkout page under discount code section.

To add it under discount code first in Checkout_index_index.xml file I have added following code.

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" 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="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">
                                                                 <item name="discount" xsi:type="array">
                                                                     <item name="children" xsi:type="array">
                                        <item name="cms-block" xsi:type="array">
                                            <item name="component" xsi:type="string">VendorName_ModuleName/js/view/cms-block</item>
                                            <item name="sortOrder" xsi:type="string">10</item>
                                        </item>
                                       </item> 
                                         </item> 
                                         </item> 
                                         </item>
                                         </item>
                                          </item>
                                         </item> 
                                      </item> 
                                   </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

Using that code it's not showing under discount code section. If I remove the following 2 lines from the above code then it adds the custom CMS block after the payment method section.

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

Is there any way we can add CMS block exactly under the discount code section?

Any help would be appreciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.