How to add two custom fields for all payment methods in my payment section of magento 2,Can any one help me on this?
$jsLayout['components']['checkout']['children']['steps']['children']['payment']['children']
['methods']['children']['paymentAdditional'] = [
'component' => 'uiComponent',
'displayArea' => 'paymentAdditional',
'children' => [
'delivery_date' => [
'component' => Vendor_Module/js/view/payment/method-renderer/taxInfo-comp',
'config' => [
'customScope' => 'methods',
'template' => 'ui/form/field',
'elementTmpl' => 'vendor_module/payment/taxinfo-form',
'options' => [],
],
'dataScope' => 'methods.tax_code',
'label' => 'Tax Code',
'provider' => 'checkoutProvider',
'visible' => true,
'validation' => false, //['required-entry' => $this->_helper->getConfigIsFieldRequired()],
'sortOrder' => 200,
]
],
];
Best Answer
If You want two add new custom field for all payment method in payment section of magento 2
you can overwrite \Magento\Checkout\Block\Checkout\LayoutProcessor
follow this sequence
/[vendor]/[module]/etc/frontend/di.xml
vandor/module/Model/Checkout/LayoutProcessorPlugin.php
Reference here