Skip to content

Instantly share code, notes, and snippets.

@bryan-snyder
Last active January 16, 2016 14:29
Show Gist options
  • Save bryan-snyder/ddb636d30e9bc004c6ba to your computer and use it in GitHub Desktop.
Save bryan-snyder/ddb636d30e9bc004c6ba to your computer and use it in GitHub Desktop.
Remove this code to make field not required.
//remove this dumb shit and make PO field not required
//lol $pooorder
public function validate_fields () {
$poorder = $this->get_post( 'po_number_field' );
if( ! $poorder ) {
if ( function_exists ( 'wc_add_notice' ) ) {
// Replace this old ass f'in $woocommerce_add_error() function.
wc_add_notice ( __ ( 'Please enter your PO Number.', 'woocommerce-gateway-purchase-order' ), 'error' );
} else {
WC()->add_error( __( 'Please enter your PO Number.', 'woocommerce-gateway-purchase-order' ) );
}
return false;
} else {
return true;
}
} // End the validation stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment