Created
August 14, 2015 23:18
-
-
Save ScottDeLuzio/c045066e7f3e09a708ea to your computer and use it in GitHub Desktop.
Add custom field to checkout page
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 page | |
*/ | |
add_action( 'woocommerce_after_order_notes', 'some_custom_checkout_field' ); | |
function some_custom_checkout_field( $checkout ) { | |
echo '<div id="some_custom_checkout_field"><h2>' . __('My Field Header') . '</h2>'; | |
woocommerce_form_field( 'some_field_name', array( | |
'type' => 'text', | |
'class' => array('my-field-class form-row-wide'), | |
'label' => __('My Field Label'), | |
'placeholder' => __('Some placeholder text to guide the customer'), | |
'required' => true, | |
), $checkout->get_value( 'some_field_name' )); | |
echo '</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment