Save woocommerce order fields in uppercase

add_filter('woocommerce_checkout_posted_data', 'my_custom_woocommerce_checkout_posted_data');
function my_custom_woocommerce_checkout_posted_data($data){

  if($data['billing_first_name']){
    $data['billing_first_name'] = strtoupper($data['billing_first_name']);
  }

  if($data['billing_last_name']){
    $data['billing_last_name'] = strtoupper($data['billing_last_name']);
  }
	
  //shipping fields too
  if($data['shipping_first_name']){
    $data['shipping_first_name'] = strtoupper($data['shipping_first_name']);
  }

  if($data['shipping_last_name']){
    $data['shipping_last_name'] = strtoupper($data['shipping_last_name']);
  }

  return $data;
}

Leave a Reply