Last active
March 3, 2022 05:10
-
-
Save devendrabisht/9b86b8be6af8fc61f2e541e3140876ee to your computer and use it in GitHub Desktop.
WooCommerce make order notes required 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
/** | |
* Make order notes required | |
*/ | |
add_filter( 'woocommerce_checkout_fields' , 'dev_woocommerce_make_order_comments_required' ); | |
function dev_woocommerce_make_order_comments_required( $fields ) { | |
$fields['order']['order_comments']['required'] = true; | |
return $fields; | |
} | |
// add_action( 'woocommerce_after_checkout_validation', 'dev_woocommerce_add_notice_for_empty_order_comments' ); | |
// function dev_woocommerce_add_notice_for_empty_order_comments() { | |
// // Check if set, if its not set add an error. | |
// if ( ! $_POST['order_comments'] ) { | |
// wc_add_notice( __( 'Please enter order notes.' ), 'error' ); | |
// } | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment