Created
April 4, 2014 09:23
-
-
Save mikejolley/9971101 to your computer and use it in GitHub Desktop.
WC customising checkout fields using actions and filters - Lesson 3 snippet 1
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
/** | |
* Add the field to the checkout | |
*/ | |
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); | |
function my_custom_checkout_field( $checkout ) { | |
echo '<div id="my_custom_checkout_field"><h2>' . __('My Field') . '</h2>'; | |
woocommerce_form_field( 'my_field_name', array( | |
'type' => 'text', | |
'class' => array('my-field-class form-row-wide'), | |
'label' => __('Fill in this field'), | |
'placeholder' => __('Enter something'), | |
), $checkout->get_value( 'my_field_name' )); | |
echo '</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment