On this weblog, we’re going to add an extra data to the checkout cost web page. Initially, we have to create a {custom} module. you’ll be able to create a module utilizing this weblog Click on Right here.
This subject incorporates fundamental details about methods to customise the view of an current checkout cost web page. Within the Magento software, checkout is applied utilizing UI elements. You may customise every step by altering the JavaScript implementation or template for a part
Step 1:- After the module creation In your {custom} module listing, create the next new file: <your_module_dir>/view/frontend/structure/checkout_index_index.xml
. (To your checkout customization to be utilized appropriately, your {custom} module ought to rely upon the Magento_Checkout module.).
Step 2:- On this file, add the next:
<?xml model="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license particulars. */ --> <web page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Format/and many others/page_configuration.xsd"> <head> <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" defer="defer" async="async" src_type="url"/> </head> <physique> <referenceBlock identify="checkout.root"> <arguments> <argument identify="jsLayout" xsi:sort="array"> <merchandise identify="elements" xsi:sort="array"> <merchandise identify="checkout" xsi:sort="array"> <merchandise identify="youngsters" xsi:sort="array"> <merchandise identify="steps" xsi:sort="array"> <merchandise identify="youngsters" xsi:sort="array"> <merchandise identify="billing-step" xsi:sort="array"> <merchandise identify="youngsters" xsi:sort="array"> <merchandise identify="cost" xsi:sort="array"> <merchandise identify="youngsters" xsi:sort="array"> <merchandise identify="beforeMethods" xsi:sort="array"> <merchandise identify="youngsters" xsi:sort="array"> <merchandise identify="place-order-custom-container" xsi:sort="array"> <merchandise identify="part" xsi:sort="string">uiComponent</merchandise> <merchandise identify="displayArea" xsi:sort="string">beforeMethods</merchandise> <merchandise identify="youngsters" xsi:sort="array"> <merchandise identify="place-order-custom" xsi:sort="array"> <merchandise identify="part" xsi:sort="string">Webkul_Custom/js/{custom}</merchandise> <merchandise identify="displayArea" xsi:sort="string">place-order-custom</merchandise> <merchandise identify="configSource" xsi:sort="string">checkoutConfig</merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </merchandise> </argument> </arguments> </referenceBlock> </physique> </web page>
Within the checkout web page, we added a part Webkul_Custom/js/{custom}, add a displayArea, and the configSource.

Change the trail to the part’s .js
file, template, or another property as per your want.
Just be sure you declare a part in order that it’s rendered appropriately by the guardian part. If a guardian part is a common UI part (referenced by the uiComponent
alias), its baby elements are rendered with none circumstances. But when a guardian part is an extension of a common UI elements, then youngsters rendering may be restricted in sure means. For instance a part can render solely youngsters from a sure displayArea
.
Step 3:- After this we have to create the next new file: <your_module_dir>/view/frontend/net/js/{custom}
.js
Step 4:- On this file, add the next:
/** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license particulars. */ outline( [ 'uiComponent', 'jquery', ], perform (Element, $) { 'use strict'; return Element.lengthen({ defaults: { template: 'Webkul_Custom/{custom}', }, initialize: perform () { this._super(); }, }); });
On this above code, we outline the template the place you must add your {custom} code as per your want.