Last active
August 29, 2015 14:06
-
-
Save SirDarcanos/3659c323e25d50d135c7 to your computer and use it in GitHub Desktop.
Add checkout VAT and SSN fields
This file contains hidden or 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
// Add VAT and SSN fields to the checkout form | |
add_filter( 'woocommerce_checkout_fields' , 'custom_add_vat_ssn_fields' ); | |
function custom_add_vat_ssn_fields( $fields ) { | |
if ( ! isset( $fields['billing']['billing_vat'] ) ) { | |
$fields['billing']['billing_vat'] = array( | |
'label' => __( 'VAT', 'your-domain' ), | |
'placeholder' => _x( 'VAT', 'placeholder', 'your-domain' ), | |
'required' => true, //change to false if you do not need this field to be required | |
'class' => array( 'form-row-first' ) | |
); | |
} | |
if ( ! isset( $fields['billing']['billing_ssn'] ) ) { | |
$fields['billing']['billing_ssn'] = array( | |
'label' => __( 'SSN', 'your-domain' ), | |
'placeholder' => _x( 'SSN', 'placeholder', 'your-domain' ), | |
'required' => true, //change to false if you do not need this field to be required | |
'class' => array( 'form-row-last' ) | |
); | |
} | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment