I followed the first steps of this documentation (https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout_new_field.html) to add a new input field (date of birth) to the shipping address form in checkout. Here is my relevant code in a plugin class:
<?php
namespace Vendor\Module\Plugin;
use Vendor\Module\Helper\Data;
class AddDob
{
private $_helper;
function __construct(
Data $helper
)
{
$this->_helper = $helper;
}
public function afterProcess($subject, $jsLayout)
{
if (!$this->_helper->isEnabled()) return $jsLayout;
$customAttributeCode = 'dob';
$customField = [
'component' => 'Vendor_Module/js/form/element/dob',
'config' => [
'customScope' => 'shippingAddress.custom_attributes',
'customEntry' => null,
'template' => 'ui/form/field',
'elementTmpl' => 'Vendor_Module/form/element/dob'
],
'dataScope' => 'shippingAddress.custom_attributes.'.$customAttributeCode,
'label' => __('Date of birth'),
'provider' => 'checkoutProvider',
'sortOrder' => $this->_helper->getSortOrder(),
'options' => [],
'filterBy' => null,
'customEntry' => null,
'visible' => true,
];
if ($this->_helper->isRequired()) {
$customField['validation']['required-entry'] = true;
}
if ($this->_helper->tooltipIsEnabled()) {
$customField['config']['tooltip'] = [
'description' => $this->_helper->tooltipGetContent()
];
}
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children'][$customAttributeCode] = $customField;
return $jsLayout;
}
}
I also implemented the plugin class via di.xml. So it works basically as you can see here:
However when I proceed to the billing form, I see two new rows in the address, one says "dob" (which is the name of my date of birth input field) and the other one displays its value, as you can see here:
But I do not want them to appear in the address. How can I get rid of it?