Created
August 14, 2015 23:19
-
-
Save ScottDeLuzio/a0c4feb419b405b96257 to your computer and use it in GitHub Desktop.
Process custom field in checkout
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
<?php | |
/** | |
* Process the checkout | |
*/ | |
add_action('woocommerce_checkout_process', 'some_custom_checkout_field_process'); | |
function some_custom_checkout_field_process() { | |
// Check if the field is set, if not then show an error message. | |
if ( ! $_POST['some_field_name'] ) | |
wc_add_notice( __( 'Please enter something here.' ), 'error' ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment