I want to pre-populate the values for the billing fields for the database of the user's stored values before his first purchase .
I tried the following code:
add_filter( 'woocommerce_checkout_fields' , function ( $fields ) {
$fields['billing']['billing_first_name']['placeholder'] = 'First Name';
$fields['billing']['billing_first_name']['default'] = wp_get_current_user()->user_firstname;
return $fields;
});
I read about this solution in another post . Placeholder works great, but it doesn't.
In addition, the WooCommerce Doc (Lesson 1) says nothing about the value of the 'default' array
source
share