I'm trying to add a checkbox above the 'billing address same as shipping address checkbox'.
I added this to my layoutProcessorPlugin:
protected function addFieldsToSubscribeToNewsletter($jsLayoutResult)
{
$jsLayoutResult['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['billing-address']['children']['subscribe_to_newsletter'] = [
'component' => 'Magento_Ui/js/form/element/abstract',
'config' => [
'customScope' => 'shippingAddress.custom_attributes',
'template' => 'ui/form/field',
'elementTmpl' => 'BigBridge_Checkout/form/element/checkbox-overwrite'
],
'provider' => 'checkoutProvider',
'dataScope' => 'shippingAddress.custom_attributes.subscribe_to_newsletter',
'description' => __('Subscribe to the newsletter'),
'sortOrder' => '1008',
'validation' => [
'required-entry' => false,
],
'displayArea' => 'checkout-newsletter-subscribe'
];
return $jsLayoutResult;
}
If i try to add it to form-fields it works but that's the wrong location. (it says shipping-step because i moved it from the billing step to shipping step). I feel like maybe i need to create a new region first, because in billing-address.html there is no region to place new fields? But i'm not sure how.
Can anyone point me in the right direction?