I need to move the VAT field to top, I can not find the file with the form or the file where I can modify it

  • can you post the snapshot of the page. Mar 11 '17 at 11:54

To change the sort order of fields on Checkout you need a LayoutProcessorPlugin.


<type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
    <plugin name="checkout-sort-order-plugin" type="Namespace\Module\Model\Checkout\LayoutProcessorPlugin" sortOrder="10"/>

Now, lets create the plugin.


namespace Namespace\Module\Model\Checkout;

class LayoutProcessorPlugin

 * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
 * @param array $jsLayout
 * @return array
public function afterProcess(
    \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
    array  $jsLayout
) {
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['vat_id'] = [
        'component' => 'Magento_Ui/js/form/element/abstract',
        'label' => __('VAT number'),
        'config' => [
            'customScope' => 'shippingAddress',
            'template' => 'ui/form/field',
            'elementTmpl' => 'ui/form/element/input',
        'provider' => 'checkoutProvider',
        'dataScope' => 'shippingAddress.vat_id',
        'sortOrder' => 1,
    return $jsLayout;

You can change the 'sortOrder' => 1, to place it between any two fields you want, but now, with value 1 is placed before all fields Checkout.

Your Answer

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

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