Make Woocommerce custom checkout field not editable

Viewed 2085

I added a custom field on the woocommerce checkout page that is populated by URL but I am struggling to find a way to make this field not editable.

I added the following code to function.php:

//Add custom field
function custom_woocommerce_checkout_fields( $checkout_fields = array() ) {

    $checkout_fields['order']['imei'] = array(
        'type'          => 'text',
        'class'         => array('my-field-class form-row-wide'),
        'label'         => __('IMEI'),
        'placeholder'   => __('imei'),
        'default' => $_GET['imei'],            
    );

    return $checkout_fields;
}
add_filter( 'woocommerce_checkout_fields', 'custom_woocommerce_checkout_fields' );

What should I change in my code to accomplish this ?

2 Answers
Related