Skip to content

Instantly share code, notes, and snippets.

@ScottDeLuzio
Created August 14, 2015 23:24
Show Gist options
  • Save ScottDeLuzio/0828fb6e039fcd88e69e to your computer and use it in GitHub Desktop.
Save ScottDeLuzio/0828fb6e039fcd88e69e to your computer and use it in GitHub Desktop.
WooCommerce checkout field hook and change default fields
<?php
// WooCommerce Checkout Fields Hook
add_filter( 'woocommerce_checkout_fields' , 'custom_wc_checkout_fields' );
// Change order comments placeholder and label, and set billing phone number to not required.
function custom_wc_checkout_fields( $fields ) {
$fields['order']['order_comments']['placeholder'] = 'Enter your placeholder text here.';
$fields['order']['order_comments']['label'] = 'Enter your label here.';
$fields['billing']['billing_phone']['required'] = false;
return $fields;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment