Created
April 29, 2020 22:34
-
-
Save vfontjr/306a0950811322e4810eb5be7a24af26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Hook in | |
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); | |
// Our hooked in function - $fields is passed via the filter! | |
function custom_override_checkout_fields( $fields ) { | |
$fields['billing']['billing_company']['label'] = 'Clinic Name'; | |
$fields['shipping']['shipping_company']['label'] = 'Clinic Name'; | |
$fields['billing']['billing_first_name']['label'] = 'Physician First Name'; | |
$fields['billing']['billing_last_name']['label'] = 'Physician Last Name'; | |
$fields['shipping']['shipping_first_name']['label'] = 'Physician First Name'; | |
$fields['shipping']['shipping_last_name']['label'] = 'Physician Last Name'; | |
$fields['billing']['dea_number'] = array( | |
'label' => __('DEA Number', 'woocommerce'), | |
'placeholder' => _x('If you are already registered, make sure to use your approved DEA Number', 'placeholder', 'woocommerce'), | |
'required' => true, | |
'class' => array('form-row-wide'), | |
'clear' => true | |
); | |
return $fields; | |
} | |
/** | |
* Display field value on the order edition page | |
**/ | |
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 ); | |
function my_custom_checkout_field_display_admin_order_meta($order){ | |
echo __('DEA Number'). ': ' . $order->order_custom_fields['_dea_number'][0]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display field value on the order edition page | |
**/ | |
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 ); | |
function my_custom_checkout_field_display_admin_order_meta($order){ | |
echo __('DEA Number').': ' . $order->dea_number; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment