• Resolved Marios Chaidousis

    (@marioselgreco)


    How to Change WooCommerce billing Fields Order of the “Αριθμ?? ΑΦΜ (Μ?νο για εταιρε?ε?)” field ? its the field of the plugin , vat field and i need to move up , under the “?νομα Εταιρ?α? (προαιρετικ?)” section .
    how to manage that ?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Diego

    (@daigo75)

    Hi Marios,
    The VAT number field is added using a filter attached to the hook woocommerce_checkout_fields. You can write your own custom filter and modify the list of fields as you need. You can refer to the official WooCommerce documentation for an example of how to implement such filter: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

    To change the order, you can set the “priority” attribute of the fields. By default, The VAT number field has a priority of 250, whereas the certification has a priority of 300 (the higher the number, the lower they will appear on the page). If I’m not mistaken, the company name has a priority of 30. In your filter, you can change the priority of the VAT fields to 31, and it should appear right after the company name.

    Konijntje

    (@konijntje)

    Hi Diego,

    I also want to move the VAT number field to above. So, I’ve put the following code in functions.php:

    add_filter(‘woocommerce_enable_order_notes_field’, ‘__return_false’);
    add_filter(‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’);
    function custom_override_checkout_fields($fields) {
    $fields[‘billing’][‘billing_company’][‘priority’] = 30;
    $fields[‘billing’][‘vat_number’][‘priority’] = 31;
    return $fields;
    }

    Unfortunately it doesn’t work. Is the label name (vat_number) correct anyway?

    • This reply was modified 6 years ago by Konijntje.
    • This reply was modified 6 years ago by Konijntje.
    Plugin Author Diego

    (@daigo75)

    Yes, “vat_number” is the correct field ID. Please note that the EU VAT Assistant adds the fields by using a filter with a priority of 40. You will have to specify a priority of 41 or higher, to alter the fields added by the plugin (e.g. add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields', 50);)

    Hi Diego,

    Thanks for your reply.
    I have added the priority, and it works!

    Cheers,
    Konijntje

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to Change WooCommerce billing Fields Order’ is closed to new replies.