Default value based on current_user data
-
Before known this plugin, I was coding into functions.php file inside my theme directory to manage the checkout fields, adding a filter like this:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { //do things with fields ... return $fields; }
But this plugin is way more intuitive, I want to use it! But I have one question:
Can I add default value to the billing_first_name which will be based on
wp_get_current_user();
?On my custom code I mentioned before, I was able to do this:
$current_user = wp_get_current_user(); $fields['billing']['billing_first_name']['default'] = esc_html( $current_user->user_firstname );
and it worked very well.
But I want to get rid of my code and use only this plugin, can I add these “dynamic” default values?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Default value based on current_user data’ is closed to new replies.