I have a dropdown menu, How can i put the value from observer or event to a dropdown on checkout page. Thank you in advance.
1 Answer
You can refer to this link: How i can add the custom dropdown at the checkout page
And add your option value into 'options'
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children']['drop_down'] = [
'component' => 'Magento_Ui/js/form/element/select',
'config' => [
'customScope' => 'shippingAddress',
'template' => 'ui/form/field',
'elementTmpl' => 'ui/form/element/select',
'id' => 'drop-down',
],
'dataScope' => 'shippingAddress.drop_down',
'label' => 'Drop Down',
'provider' => 'checkoutProvider',
'visible' => true,
'validation' => [],
'sortOrder' => 251,
'id' => 'drop-down',
'options' => [
[
'value' => '',
'label' => 'Please Select',
],
[
'value' => '1',
'label' => 'First Option',
]
]
];