added checkout fields not saving to post_meta
-
Hi guys!
I’ve added custom checkout fields using the docs:
//Add checkout fields add_filter( 'woocommerce_checkout_fields' , 'add_checkout_fields' ); function add_checkout_fields( $fields ) { $fields['billing']['type_klant'] = array( 'type' => 'radio', 'label' => 'Type klant', 'clear' => true, 'required' => true, 'options' => array( 'option_1' => 'Particulier', 'option_2' => 'Zakelijk' ) ); $fields['billing']['factuur_email'] = array( 'label' => 'Factuur emailadres', 'placeholder' => 'Factuur emailadres', 'required' => false, //'class' => array('form-row-wide'), 'clear' => true ); $fields['billing']['kvk_nr'] = array( 'label' => 'KVK #', 'placeholder' => 'vul hier uw KVK nummer in', 'required' => false, //'class' => array('form-row-wide'), 'clear' => true ); $fields['billing']['functie'] = array( 'label' => 'Functie', 'placeholder' => 'vul hier uw functie in', 'required' => false, //'class' => array('form-row-wide'), 'clear' => true ); $fields['billing']['aanhef'] = array( 'type' => 'radio', 'label' => 'Aanhef', 'clear' => true, 'required' => true, 'options' => array( 'option_1' => 'Mevr', 'option_2' => 'Dhr' ) ); return $fields; }
They display fine. Now I want to add them to the backend and email, I was stuggeling until I checked the
wp_postmeta
table and found my added fields ARE present but are all empty
whats up with that?What do we do with the new field? Nothing. Because we defined the field in the checkout_fields array, the field is automatically processed and saved to the order post meta (in this case, _shipping_phone). If you want to add validation rules, see the checkout class where there are additional hooks you can use.
states It is saved automatically? with me it isnn’t any clues?
Thanks!
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘added checkout fields not saving to post_meta’ is closed to new replies.