Skip to content

Instantly share code, notes, and snippets.

Created June 9, 2016 14:28
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save frankschrijvers/07e42d852531760739f235e9fdc21759 to your computer and use it in GitHub Desktop.
Process the checkout and set error message
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Process the checkout
add_action('woocommerce_checkout_process', 'wps_select_checkout_field_process');
function wps_select_checkout_field_process() {
global $woocommerce;
// Check if set, if its not set add an error.
if ($_POST['daypart'] == "blank")
wc_add_notice( '<strong>Please select a day part under Delivery options</strong>', 'error' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment