The Hook that you have provided is correct. However, could you please verify whether the section name is “additional”? This is because the woocommerce default section names are billing, shipping, account, order.
If the above information won’t help, then please provide a higher value for the priority say, 99 for the hook.
We hope this will help 🙂
Thank you.
I’ve just tried the following:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields', 99 );
function custom_override_checkout_fields( $fields ) {
var_dump($fields);
}
This dumps all billing and shipping data, but it doesn’t contain any fields within additional. Is it possible that add_filter( 'woocommerce_checkout_fields', 'name_here' );
is only able to retrieve WooCommerce core checkout data? The only way I’ve managed to get it working at the minute is to hack checkout-form-designer.php with the following:
if(!in_array($_SERVER['REMOTE_ADDR'], $allowed_ips)) {
unset($fields['order']['sales_person']);
}
… but that’s the last thing I wanted to do!
Could you please try again with a higher value 2000 for the hook priority. And with section name “order” instead of “additional”.
Yes! You’re absolutely right, it falls under “order” and setting the value to 2,000 made the additional content show. Many thanks for your help with this!
-
This reply was modified 7 years, 2 months ago by
LiamMcArthur. Reason: marking as resolved
Glad we are able to help you 🙂
Thank you and have a great day!