Aller au contenu
FR

Maximum number of Characters WooCommerce Filter

Version audio de cet article

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;
}