title: PHP to take data from WCFM Order meta, and push into AST plugin
body: <p>While im pretty hopeless at php, i feel like im getting close on this one, i just cant quite lock it in</p>
  <p>So we have 2 plugins in the mix here WCFM &amp; AST</p>
  <p>In WCFM, a vendor adds a tracking number and carrier this is store in the order meta data with a meta keys of
  wcfm_tracking_code
  AND
  wcfm_tracking_url</p>
  <p>i found this hook elesewhere that allows me to fire a set of things to happen, once the tracking has been submitted into the system</p>
  <pre><code>“wcfm_after_order_mark_shipped” (Parameters -&gt; $order_id, $order_item_id, $tracking_code, $tracking_url)
  </code></pre>
  <p>so now i want to take the above 2 order meta datas and push them into another plugin called AST
  They code they provide to push data into thier system is:</p>
  <pre><code>&lt;?php if ( class_exists( 'WC_Advanced_Shipment_Tracking_Actions' ) ) {
  
  $order_id = '123'; //Replace with your order id
  $tracking_provider = 'USPS'; //Replace with your shipping provider
  $tracking_number = '123123'; //Replace with your tracking number
  $date_shipped = '2020-06-22'; ////Replace with your shipped date
  $status_shipped = 1; // 0=no,1=shipped,2=partial shipped(if partial shipped order status is enabled)
  $sku = 't-shirt,blue-jeans'; //the line item (product) SKU
  $qty = '1,1'; //the line item (product) quantity
  
  if ( function_exists( 'ast_insert_tracking_number' ) ) {
      ast_insert_tracking_number( $order_id, $tracking_number, $tracking_provider, $date_shipped, $status_shipped, $sku, $qty );
  }
  </code></pre>
  <p>}</p>
  <p>SO using both codes provided, can anyone show me how i can take the metadata input from WCFM and push it into AST?</p>
  <p>Ive hired someone on upwork, and they cant even figure it out, but it seems so straightforward.</p>
  <p>This is the code we have,it pushes the data in but it comes in looking like this</p>
  <p><a href="https://i.stack.imgur.com/jF76V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jF76V.png" alt="enter image description here" /></a></p>
  <p>Instead of this like it should</p>
  <p><a href="https://i.stack.imgur.com/6QNsR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6QNsR.png" alt="enter image description here" /></a></p>
  <pre><code>add_action( 'wcfm_after_order_mark_shipped', 'testwr', 99, 6 );
  function testwr( $order_id, $order_item_id, $tracking_code, $tracking_url, $product_id, $wcfm_tracking_data ) {
      $order = wc_get_order( $order_id );
      $data['order_id'] = $order_id;
      $data['tracking_provider'] = $tracking_url; 
      $data['wcfm_tracking_code'] = $wcfm_tracking_data['wcfm_tracking_code'];
      $data['date_shipped'] = $order-&gt;order_date;
      $data['status_shipped'] = 1;
      extract($data);
      foreach ($order-&gt;get_items() as $item) {
          $product = wc_get_product($item-&gt;get_product_id());
          $item_quantity[] = $item-&gt;get_quantity();
          $item_sku[] = $product-&gt;get_sku();
      }
      if( $item_sku ) {
          $data['sku'] = implode( &quot;,&quot;,$item_sku );
      }
      $tracking_url = $tracking_url . &quot;/&quot; . $tracking_code;
      $url = &quot;&lt;a href='&quot;.$tracking_url.&quot;'&gt;test&lt;/a&gt;&quot;;
      $data['qty'] = implode( &quot;,&quot;,$item_quantity );
      $test = ast_insert_tracking_number( $order_id, $tracking_url, $tracking_url, $date_shipped, $status_shipped, $sku, $qty);
      var_dump($test);
      print_r($tracking_code);
      print_r($data);
      print_r($wcfm_tracking_data);
      var_dump($order_item_id);
      //ast_insert_tracking_number
      die();
  }
  </code></pre>
  <p>Kudos to anyone willing to give this a try and some time</p>
  <p>Regards</p>