How can we improve WooCommerce?

Customize Additional fields in checkout with filter "woocommerce_checkout_fields"

Actually, you cannot unset or modify properties of an additional field on checkout form using the filter "woocommerce_checkout_fields" because the parameter of priority established on filter declaration is set to 1000 instead of 1, and because that the filter doesn't works with additional fields.

To solve this, you must modify the filter declaration on line 288 of file: "woocommerce-checkout-field-editor.php"

Original line 288:

add_filter( 'woocommerce_checkout_fields', 'wc_checkout_fields_modify_order_fields', 1000 );

Modified line:

add_filter( 'woocommerce_checkout_fields', 'wc_checkout_fields_modify_order_fields', 1 );

Now, you can customize your additional fields using this filter with sentences like that:

unset($fields['order']['additional-field']);
$fields['order']['additional-field']['title] = "New title";
etc.......

Please, can you have this change in mind for next update?.

Thanks!.

3 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Roberto shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...

WooCommerce: Extension - WooCommerce Checkout Field Editor

Feedback and Knowledge Base