alejomejia
1/31/2018 - 4:58 PM

Change fields on Checkout page

/*

--- FIELDS ---

# BILLING #

billing_first_name
billing_last_name
billing_company
billing_address_1
billing_address_2
billing_city
billing_postcode
billing_country
billing_state
billing_email
billing_phone

# SHIPPING #

shipping_first_name
shipping_last_name
shipping_company
shipping_address_1
shipping_address_2
shipping_city
shipping_postcode
shipping_country
shipping_state

# ACCOUNT #

account_username
account_password
account_password-2

# OTHERS #

order_comments

--- PROPERTIES ---

type – type of field (text, textarea, password, select)
label – label for the input field
placeholder – placeholder for the input
class – class for the input
required – true or false, whether or not the field is require
clear – true or false, applies a clear fix to the field/label
label_class – class for the label element
options – for select boxes, array of options (key => value pairs)

*/


add_filter( 'woocommerce_checkout_fields' , 'custom_checkout_fields' );

function custom_checkout_fields( $fields ) {

  unset($fields['billing']['billing_company']);
  unset($fields['billing']['billing_postcode']);
  
  $fields['billing']['billing_phone']['placeholder'] = 'Número de móvil preferiblemente';
  
  return $fields;
	
}