I am collecting an additional User Meta Data for my Woo commerce check out page.
woocommerce_form_field('myName', array(
'type' =>'text',
'class'=>array('my-field-class form-row-wide'),
'label'=>__('First Name'),
'placeholder'=>__('Please enter your name'),
), $checkout->get_value('myName'));
And I am updating to the database with this code:
/*Update the info with the checkout*/
add_action('woocommerce_checkout_field_update_order_meta','my_custom_checkout_field_update_meta');
function my_custom_checkout_field_update_meta($order_id){
if($_POST['MyName'])
update_post_meta($order_id, 'First Name',esc_attr($POST['MyName']));
}
Each time I submit, I get an internal server Error, even though I am working on a local machine. I need to collect that data and persist it into the order Database. Anybody help?