Customizing and adding woocommerce template data
<p>I am having some trouble customizing the woocommerce templates in my wordpress theme. I would like to add additional data as variables in my templates.</p>

<p>I want to show active orders on the dashboard/my-account page. I want to do this by passing in order data variables to the template to be able to call, like how it is done in the <code>orders.php</code> template. </p>

<p>I know I can override the <code>wc-template-functions.php</code> in my theme and then add the data in the <code>wc_get_templates</code> function for the dashboard or my account. However, I don't want to do this. </p>

<p>What I've tried is creating a hook such as:</p>

<p><strong>functions.php</strong></p>

<pre><code>function wc_fr_add_orders_to_account( $fr_account_orders, $current_page ) {
  global $fr_account_orders;
  $current_page = empty( $current_page ) ? 1 : absint( $current_page );

  $customer_orders = wc_get_orders( apply_filters( 'woocommerce_my_account_my_orders_query', 
    array( 
      'customer' =&gt; get_current_user_id(), 
      'page' =&gt; $current_page, 
      'paginate' =&gt; true,
      'status' =&gt; array( 'wc-pending' )
      ) ) );

  $fr_account_orders = array(
    'current_page' =&gt; absint( $current_page ),
    'customer_orders' =&gt; $customer_orders,
    'has_orders' =&gt; 0 &lt; $customer_orders-&gt;total
  );

  return $fr_account_orders;
}
add_action( 'woocommerce_account_content', 'wc_fr_add_orders_to_account' );
</code></pre>

<p><strong>/theme-directory/woocommerce/templates/myaccount/dashboard.php</strong> (also tried in my-account.php)</p>

<pre><code>do_action( 'woocommerce_account_dashboard', $fr_account_orders);
var_dump($fr_account_orders);
</code></pre>

<p><code>$fr_account_orders</code> comes back null. However if I <code>var_dump</code> the array in the hook function, it comes back with data. Any help is appreciated.</p>