title: Get list of CITIES from Shipping rates based on city
body: <p>So, I was following this example on <a href="https://jeroensormani.com/changing-the-city-field-to-a-dropdown/" rel="nofollow noreferrer">How to change the city field to a dropdown by Jeroen</a> in my Billing/Shipping section of my site.</p>
  
  <pre><code>/**
   * Change the checkout city field to a dropdown field.
   */
  function city_to_dropdown( $fields ) {
      $city_args = wp_parse_args( array(
          'type' =&gt; 'select',
          'options' =&gt; array(
              'amsterdam' =&gt; 'Amsterdam',
              'rotterdam' =&gt; 'Rotterdam',
              'den-haag'  =&gt; 'Den Haag',
              'utrecht'   =&gt; 'Utrecht',
              'leiden'    =&gt; 'Leiden',
              'groningen' =&gt; 'Groningen',
          ),
      ), $fields['shipping']['shipping_city'] );
      $fields['shipping']['shipping_city'] = $city_args;
      $fields['billing']['billing_city'] = $city_args; // Also change for billing field
      return $fields;
  }
  add_filter( 'woocommerce_checkout_fields', 'city_to_dropdown' );
  </code></pre>
  
  <p>Everything works as expected, but here is what I want to do different.</p>
  
  <p>I want to be able to query all the list of cities from the from <strong>shipping rates based on city</strong> and display them in the dropdown code above.</p>
  
  <p><a href="https://i.stack.imgur.com/9v35z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9v35z.png" alt="enter image description here"></a></p>
  
  <p>So then I wouldn’t have to add the cities manually in multiple places. My list of cities will always be the cities added in using the <strong>shipping rates based on city</strong> functionality.</p>
  
  <p>What do I need to do to be able to remove the manually entered cities and have something similar to the following :</p>
  
  <pre><code>‘options’ =&gt; get_list_cities_from_shipping_rate(),
  </code></pre>
  
  <p><br>
  <strong><h2>Question :</h2></strong></p>
  
  <p>What <a href="https://docs.woocommerce.com/wc-apidocs/hook-docs.html" rel="nofollow noreferrer">filters or hooks</a> in woocommerce do I have to call to be able to return the list of cities in my function <code>get_list_cities_from_shipping_rate()</code> ?</p>
  
  <p><br>
  I'm new to writing these custom codes in wordpress. Any help pointers on how to get this started would be appreciated.</p>
  
  <p>Thank you in advance</p>