F
F
fsb_262017-03-17 02:49:00
WooCommerce
fsb_26, 2017-03-17 02:49:00

How to add value to billing_first_name field on checkout woocommece page?

I want to substitute the profile name in the billing_first_name field on the checkout page.
Please tell me how to do it with value.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mike, 2017-03-19
@MikeKosulin

<?php
  add_filter( 'woocommerce_checkout_fields' , 'default_values_for_checkout_fields' );
  function default_values_for_checkout_fields( $fields ) {
    $fields['billing']['billing_first_name']['default'] = 'Name';
         return $fields;
  }
?>

Well, for example, and then hide this field through CSS, but why?
If this field is not required, then it is better to use
unset($fields['billing']['billing_first_name']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question