Created
May 11, 2021 10:19
-
-
Save jjmontalban/e9537dd799222736553bcac874bdbaa8 to your computer and use it in GitHub Desktop.
Add extra fields to Billing Form
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 | |
/** | |
* @snippet Añadir nuevo campo al billing form | |
*/ | |
add_filter('woocommerce_billing_fields', 'custom_woocommerce_billing_fields'); | |
// Backend: Display editable custom billing fields | |
//add_filter( 'woocommerce_admin_billing_fields' , 'add_admin_custom_fields' ); | |
function custom_woocommerce_billing_fields($fields) | |
{ | |
$fields['billing_phone2'] = array( | |
'label' => __('Teléfono 2', 'woocommerce'), // Add custom field label | |
'placeholder' => _x('', 'placeholder', 'woocommerce'), // Add custom field placeholder | |
'required' => true, | |
'clear' => false, // add clear or not | |
'type' => 'text', // add field type | |
'class' => array('input-text'), // add class name | |
'description' => 'Teléfono alternativo', | |
); | |
$fields['billing_cif'] = array( | |
'label' => __('CIF/NIF', 'woocommerce'), // Add custom field label | |
'placeholder' => _x('', 'placeholder', 'woocommerce'), // Add custom field placeholder | |
'required' => true, | |
'clear' => false, // add clear or not | |
'type' => 'text', // add field type | |
'class' => array('input-text'), // add class name | |
'description' => 'Codigo Identificacion Fiscal', | |
); | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment