Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@frankschrijvers
Created June 9, 2016 14:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankschrijvers/07e42d852531760739f235e9fdc21759 to your computer and use it in GitHub Desktop.
Save frankschrijvers/07e42d852531760739f235e9fdc21759 to your computer and use it in GitHub Desktop.
Process the checkout and set error message
<?php
//* 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