title: Run a function on custom button click in woocommerce admin order page
body: <p>Based on <em>"<a href="https://stackoverflow.com/questions/49437781/add-a-button-on-top-of-admin-orders-list-in-woocommerce/49438775#49438775">Add a button on top of admin orders list in woocommerce</a>"</em> answer code, I was able to add a custom button on woocommerce admin orders list. </p>
  
  <p>Here is that code <em>(lightly customized)</em>:</p>
  
  <pre><code>add_action( 'manage_posts_extra_tablenav', 'admin_order_list_top_bar_button', 20, 1 );
  function admin_order_list_top_bar_button( $which ) {
      global $typenow;
  
      if ( 'shop_order' === $typenow &amp;&amp; 'top' === $which ) {
          ?&gt;
          &lt;div class="alignleft actions custom"&gt;
              &lt;button type="submit" name="custom_" style="height:32px;" class="button" value=""&gt;&lt;?php
                  echo __( 'Import Couriers', 'woocommerce' ); ?&gt;&lt;/button&gt;
          &lt;/div&gt;
          &lt;?php
      }
  }
  </code></pre>
  
  <p>Now I need to run a the following function when this custom button is clicked:</p>
  
  <pre><code>function update_shipping_couriers_meta_field() {
      $dir = __DIR__;
      $couriers = file( $dir . '/import-couriers.csv', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES );
      $count = count(couriers);
      $i = 1;
  
      do {
          if ( !empty( $couriers ) ) {
              foreach ( $couriers as $a ) {
                  if ( !empty( $a ) ) {
                      $rows = explode(';', $a);
  
                      $id = $rows[0];
                      $id = int($id);
                      $couriers = $rows[1];
  
                      update_post_meta( $id, '_shipping_couriers', $couriers );
                  }
                  $i++;
              }
          }
      } 
      while ( $i &lt;= $count );
  }
  </code></pre>
  
  <p>In practice, the function updates a "_shipping_couriers" custom field based on a specific order ID. The two values ​​are present in a csv file.</p>
  
  <p>I've already tested it and it's working. I "just" have it run when I click on the button I created with the function above.</p>
  
  <p>How can I run my function when the button is clicked?</p>