Problem with hook woocommerce_checkout_fields
-
Hi everyone,
I’m trying to use the hook woocommerce_checkout_fields to put some default data in the billings fields of the checkout.
I’ve install a WordPress on a test website : https://maxence.jdemo.ch/
I’ve install the theme “Storefront” and put this code in the function.php file (it’s just for a test, I know that there should be a child theme):
add_filter( 'woocommerce_checkout_fields', 'bbloomer_set_checkout_field_input_value_default' ); function bbloomer_set_checkout_field_input_value_default($fields) { $fields['billing']['billing_city']['default'] = 'London'; return $fields; }
But it’s not working, I don’t see the value “London” in the Billing field “City”.
I’ve enabled WP logs but there’s no error…
If any of you have any leads, I’d love to hear from you. Thanks !
My configuration:
WordPress 6.4.3
WooCommerce 8.5.2
Storefont 4.5.4
PHP 8.1
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Problem with hook woocommerce_checkout_fields’ is closed to new replies.