Friday 15 March 2013

wordpress - Custom fields not showing on order -


I have some custom fields in my WooCommerce setup, though I am trying to display them on order view. / P>

This is my code (a custom field for it):

  add_action ('woocommerce_after_order_notes', 'my_custom_checkout_field'); Function my_custom_checkout_field ($ checkout) {echo '& lt; Div id = "my_custom_checkout_field" & gt; & Lt; H3 & gt; ' .__ ('Additional Information'). '& Lt; / H3 & gt; '; ('My-field-class-form-row-wide'), 'label' = & gt; __ ('Date' ('1995', 'woocommerce'), 'placeholder' = & gt; __ ('enter something'), 'expected' => true, 'option' => array ('1995 ', & Gt; __ (' 1995 ',' woocommerce '),' 1994 '= & gt; __ (' 1994 ',' vaickorf ')), $ checkout-> Get_value ('date_of_birth'));   

I thought it would work on adding it to the order view but it is not .. or am I completely wrong and not saving custom fields? add_action ('woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta'); Function my_custom_checkout_field_update_order_meta ($ order_id) {if ($ _POST ['date_of_birth']) update_post_meta ($ order_id, 'additional information', esc_attr ($ _ POST ['date_of_birth']));

I then looked through stackoverflow and found some more information and tried it: prefax function my_custom_checkout_field1 ($ command) {echo "

This order adds "date of birth" to look at, but unfortunately after this I have tried both _date_of_birth and date_of_birth, apparently it needed extra _ unfrent, I found that answer here:

I have tried to look inside the database, but Additional details can not be found on the order displayed anywhere (Order ID

Can anyone tell me what I am doing and what can I do to show the field when I look for the order?

Thanks

I do not know, but this:

  'Additional Information'   

here:

  update_post_meta ($ post_id, $ meta_key, $ meta_value, $ prev_value);   

Are you sure 'extra information' is $ meta_key? "Date_of_birth" is not?

No comments:

Post a Comment