NB: Make sure you do a back up of your theme, files and database before attempting the tutorials
Easy
Last modified : Sep 07 2022
Estimated reading time : 0 minutes, 42 seconds - 64 words
Share the post "Maximum number of Characters WooCommerce Filter"
With this tutorial, we will force a number of characters in the Woocommerce ID: order_comments.
Maximum number of Characters WooCommerce Filter
Add this filter to your functions.php file and then change the number 300 for the number of characters you want. This will force users to limit their message to the number of characters you’ll have set.
///////////////////////////////////////////////////////////////// // Forcer max caraters div message commande ///////////////////// ///////////////////////////////////////////////////////////////// add_filter( 'woocommerce_checkout_fields', 'themespress_checkout_fields' ); function themespress_checkout_fields( $fields ) { $fields['order']['order_comments']['maxlength'] = 300; return $fields; }