Created
March 12, 2020 20:35
-
-
Save Njengah/de98ef7bf514c3e4e4efa06d8f863532 to your computer and use it in GitHub Desktop.
WooCommerce make order notes or order comments required https://njengah.com/make-woocommerce-order-comments-required/
This file contains hidden or 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
<?php | |
/** | |
* Code Snippet should be added to the functions.php to make WooCommerce order comments required | |
*/ | |
add_action('woocommerce_after_checkout_validation', 'njengah_make_woocommerce_order_comments_required'); | |
function njengah_make_woocommerce_order_comments_required() { | |
// Check if order comments are set, if its not set add an error. | |
if ( ! $_POST['order_comments'] ) | |
wc_add_notice( __( 'Please add delivery instructions' ), 'error' ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment