• Hello,

    I have customised the order_comments field in my functions.phph to call it a Gift Message as per code below. Now I would like to limit the number of characters that can be input to 100.

    Can anyone suggest how to do this?

    Many thanks

    function custom_override_checkout_fields( $fields ) {
         $fields['order']['order_comments']['placeholder'] = 'If your item is a gift, type your gift message here (max 100 characters)';
         $fields['order']['order_comments']['label'] = 'Gift Message';
         return $fields;
    }

    https://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • You just need to hook your function for the filter woocommerce_checkout_fields. Just add the line below.

    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

    Hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Max characters for order_comments’ is closed to new replies.