I have added custom field in checkout page using below code:

        ['shippingAddress']['children']['customer-email']['children']['before-login-form']['children']['youngevity_id'] = [
            'component' => 'Magento_Ui/js/form/element/abstract',
            'config' => [
                'customScope' => 'shippingAddress',
                'template' => 'ui/form/field',
                'elementTmpl' => 'ui/form/element/input',
                'options' => [],
                'id' => 'yougevity-id'
            'dataScope' => 'shippingAddress.youngevity_id',
            'label' => 'Were you referred to?',
            'provider' => 'checkoutProvider',
            'visible' => true,
            'validation' => [
               'required-entry' => true
            'sortOrder' => 1,
            'value' => $this->helper->getReferralCustomerId(),
            'id' => 'yougevity-id'

But it's add field out side login form. So I need it within login form but above Email address field.

Any help is appreciate.enter image description here

  • 2
    You have add filed in "before-login-form". Try to to add it in "additional-login-form-fields".Please Note it will display field Below Email address filed, if you want to display it above then you need to override vendor\magento\module-checkout\view\frontend\web\template\form\element\email.html file. Hope this helps you.. – Nilesh Gosai Feb 8 '18 at 5:18

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.