title: WooCommerce required fields error
body: <p>I have made a custom design for my WooCommerce checkout and for the longest time it worked just fine, however it seems recently I can no longer checkout. Even if I fill out all the fields I get an error saying that I must fill out certain fields. This is the code that I use and I am looking to either fix it so that it only requires the fields that I have in this code or worst case to just write a code so it never demands anything to be filled out.</p>
  
  <p><strong>I have done some further testing and I am using only billing fields, but the errors are appearing for shipping fields. I need to make shipping and billing fields one and the same or to just no longer have shipping fields required as the billing fields seem to work perfectly.</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>function custom_override_checkout_fields( $fields ) {
      unset($fields['billing']['billing_company']);
      unset($fields['billing']['billing_country']);
      unset($fields['billing']['billing_address_2']);
  
      return $fields;
  }
  
  add_filter( 'woocommerce_package_rates', 'my_hide_shipping_when_free_is_available', 100 );
  
  add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
  
  
  // for billing fields
  
      add_filter("woocommerce_checkout_fields", "new_order_fields");
  
          function new_order_fields($fields) {
  
              $order = array(            
                  "billing_first_name",
                  "billing_last_name",
                  "billing_address_1",
                  "billing_city",
                  "billing_postcode",
                  "billing_phone",
            "billing_email"
  
              );
              foreach($order as $field)
              {
                  $ordered_fields[$field] = $fields["billing"][$field];
              }
  
              $fields["billing"] = $ordered_fields;
              return $fields;
  
          }
  
            // for shipping fields
          add_filter("woocommerce_checkout_fields", "new_shiping_order_fields");
  
          function new_shiping_order_fields($fields) {
  
              $order = array(  
                  "shipping_city",
                  "shipping_postcode",
                  "shipping_country",   
                  "shipping_first_name",
                  "shipping_last_name",
                  "shipping_company",
                  "shipping_address_1",
                  "shipping_address_2"
  
              );
              foreach($order as $field)
              {
                  $ordered_fields[$field] = $fields["shipping"][$field];
              }
  
              $fields["shipping"] = $ordered_fields;
              return $fields;
  
          }
  // WooCommerce Checkout Fields Hook
  add_filter( 'woocommerce_checkout_fields' , 'custom_wc_checkout_fields' );
   
  // Change order comments placeholder and label, and set billing phone number to not required.
  function custom_wc_checkout_fields( $fields ) {
  $fields['billing']['billing_first_name']['placeholder'] = 'Fornavn';
  $fields['billing']['billing_first_name']['label'] = false;
  $fields['billing']['billing_last_name']['placeholder'] = 'Efternavn';
  $fields['billing']['billing_last_name']['label'] = false;
  $fields['billing']['billing_address_1']['placeholder'] = 'Adresse';
  $fields['billing']['billing_address_1']['label'] = false;
  $fields['billing']['billing_postcode']['placeholder'] = 'Postnummer';
  $fields['billing']['billing_postcode']['label'] = false;
  $fields['billing']['billing_city']['placeholder'] = 'By';
  $fields['billing']['billing_city']['label'] = false;
  $fields['billing']['billing_phone']['placeholder'] = 'Telefon';
  $fields['billing']['billing_phone']['label'] = false;
  $fields['billing']['billing_email']['placeholder'] = 'E-mail';
  $fields['billing']['billing_email']['label'] = false;
  
  return $fields;
  }
  function ra_change_translate_text_multiple( $translated ) {
      $text = array(
          'Send til en anden adresse?' =&gt; 'Tryk her for at vælge en alternativ leveringsadresse',
          'Billing details' =&gt; '1. Kundeinformationer',
          'Din ordre' =&gt; 'Deres bestilling',
          'Opret en konto?' =&gt; 'Gem mine informationer til næste køb',
          'Afgiv ordre' =&gt; 'Gå til sikker betaling',
          'Bemærkninger om Deres bestilling, f.eks. særlige bemærkninger for levering.' =&gt; 'Indtast kommentar til ordre eller specielle ønsker her.'
      );
      $translated = str_ireplace(  array_keys($text),  $text,  $translated );
      return $translated;
  }
  add_filter( 'gettext', 'ra_change_translate_text_multiple', 20 );
  /**
   * Add the field to the checkout page
   */
  add_action('billing_email', 'customise_checkout_field');
  
  function customise_checkout_field($checkout)
  {
      echo '&lt;div id="customise_checkout_field"&gt;&lt;h2&gt;' . __('Heading') . '&lt;/h2&gt;';
      woocommerce_form_field('customised_field_name', array(
          'type' =&gt; 'text',
          'class' =&gt; array(
          'my-field-class form-row-wide'
          ) ,
          'label' =&gt; __('Customise Additional Field') ,
          'placeholder' =&gt; __('Guidence') ,
          'required' =&gt; true,
      ) , $checkout-&gt;get_value('customised_field_name'));
      echo '&lt;/div&gt;';
  }</code></pre>
  </div>
  </div>
  </p>