0

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 1

0

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',
            ]
        ]
    ];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.