Reputation: 1819
So, I want to put a custom value on the first name and last name fields on the checkout page. I can use this hook in order to change all field properties beside the value:
// WooCommerce Checkout Fields Hook
add_filter( 'woocommerce_checkout_fields' , 'custom_wc_checkout_fields' );
// Change order comments placeholder and label, and set billing phone number to not required.
function custom_wc_checkout_fields( $fields ) {
$fields['billing']['billing_last_name']['required'] = true;
$fields['billing']['billing_last_name']['placeholder'] = 'whatever';
$fields['billing']['billing_last_name']['value'] = 'not working';
$fields['billing']['billing_first_name']['required'] = true;
$fields['billing']['billing_first_name']['placeholder'] = 'whatever';
$fields['billing']['billing_first_name']['value'] = 'not working';
return $fields;
}
in their codex they don't mention any option for doing that. Thanks.
Upvotes: 1
Views: 1447