title: Accessing the Order object in a custom function from a Woocommerce metabox
body: <p>I am very new to Wordpress and Woocommerce. Below is some part of my code that I am using to add a custom metabox to order admin single pages:</p>
  
  <pre><code>add_action('add_meta_boxes', 'new_meta_box');
  
  function new_meta_box(){
  add_meta_box(
      'new_meta_box',
      'New Meta Box',
      'new_meta_box_button',
      'shop_order',
      'side',
      'high'
  );
  }
  
  function new_meta_box_button(){
  
  submit_button('New Meta Box Button', 'primary','new_meta_box_button');      
  
  global $post;
  $order_id = $post-&gt;ID;
  $order = wc_get_order($order_id);
  $order_number = absint($order-&gt;get_order_number());
  
  button_action($order);  
  }   
  
  add_action('save_post','button_action');
  
  function button_action($order){
   //unbale to access $order here
  
  if(!isset($_POST['new_meta_box_button'])){
          return;
      }
  
   get_value($order);
   }
  
  function get_value($order){
  
  //unable to access $order here
  // var_dump($order) shows nothing
  $order_id = $order-&gt;get_order_number();
  
  $json = get_json($order_id);
  
  $option_value = get_option( 'option_meta_key' );
  
  }
  </code></pre>
  
  <p>In this code, if I use the custom function <code>get_the_order()</code> under get_order_details, it works. My problem, is that I need to access the WC_Order object <code>$order</code> in various functions throughout the file. </p>
  
  <p>This is all on the admin end with an already existing order so no new order is being created. I need certain details of the order in one function like shipping details and billing details in another function...so on and so forth.</p>
  
  <p>What am I doing wrong? How can I access the order object from an external custom function?</p>