Skip to content

Instantly share code, notes, and snippets.

@ScottDeLuzio
Created August 14, 2015 23:19
Show Gist options
  • Save ScottDeLuzio/a0c4feb419b405b96257 to your computer and use it in GitHub Desktop.
Save ScottDeLuzio/a0c4feb419b405b96257 to your computer and use it in GitHub Desktop.
Process custom field in checkout
<?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