0

I can't find the file or the html for guest shipping address. I want to change the telephone input type from input type = text to input type = number. Any suggestion where to find it or how to customize this bug? (To produce this bug, checkout an item without logging in) Thank you!

enter image description here

1 Answer 1

0

The checkout forms are made with UI components. In order to modify shipping address form you have to extend it with a custom module. Before we go to extending, first you need to know how the UI components are build and rendered (if you don't know please check documentation or other sources). If you got to vendor/magento/module-checkout/view/frontend/layout/checkout_index_index.xml you can find a node shipping-address-fieldset and in his children you can find a telephone. If you check other nodes, such as region_id you can see they have a component, config/template and config/elementTemplate nodes. So you have two options:

  • modify the form via custom view/frontend/layout/checkout_index_index.xml file. In the file you have to create the same path to the telephone node as it is in core file, and then change the component or templates.
  • create an after plugin on the getCheckoutConfig() function of Magento\Checkout\Block\Onepage class. And modify the array that this functions is returning. The array contains all the data from xml file.

I would recommend the 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.