0

I have added dropdown custom field on checkout page with custom values. It's working fine but when i move to next step it doesn't work.

If i add a text field and click next console shows the input field value but if I change it to select then it doesn't even field name in a console. What could be the issue?

  <?php
   namespace Jack\CheckoutAdditionalField\Plugin\Checkout\Model\Checkout;


 class LayoutProcessor
  {
/**
 * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
 * @param array $jsLayout
 * @return array
 */
public function afterProcess(
    \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
    array  $jsLayout
) {
    $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
    ['shippingAddress']['children']['shipping-address-fieldset']['children']['delivery_date'] = [
        'component' => 'Magento_Ui/js/form/element/abstract',
        'config' => [
            'customScope' => 'shippingAddress',
            'template' => 'ui/form/field',
            'elementTmpl' => 'ui/form/element/date',
            'options' => [],
            'id' => 'delivery-date'
        ],
        'dataScope' => 'shippingAddress.delivery_date',
        'label' => 'Delivery Date',
        'provider' => 'checkoutProvider',
        'visible' => true,
        'validation' => [],
        'sortOrder' => 250,
        'id' => 'delivery-date'
    ];

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

    return $jsLayout;
}

}

When i move to next step on payment method then field and it's value is not showing in console if i will add text field then it will show posted value in console.

Need help why select dropdown value not showing in console? Also, how can i save this value to show in order information.

  • Did you get the solution ? – Manish Dec 12 '17 at 12:06
  • No, i didn't. Lost the client because of that. – jack Dec 13 '17 at 5:51
  • I have added option again inside the config....somehow thats work for me – Manish Dec 13 '17 at 6:01
  • hi @jack let me know whether you got solution for this? can you please post the answer – Nagaraju Kasa Jul 30 '18 at 9:00
  • Hi, Yes got solution for this – jack Jul 30 '18 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.