kilbot / WooCommerce-POS

:bangbang: All development now at https://github.com/wcpos.
http://wcpos.com
GNU General Public License v3.0
354 stars 126 forks source link

Adding invoice ID from German market plugin to WooCommerce-POS Pro #218

Open atxcowboy opened 4 years ago

atxcowboy commented 4 years ago

I'm required to fetch the invoice number metadata from the German marketplace plugin (based on the order_number value and add it to the template temple-receipt.php

In the template I see:

<tr>
    <th><?php /* translators: woocommerce */ _e( 'Order Number', 'woocommerce' ); ?></th>
    <td>{{order_number}}</td>
  </tr>

How can I get the {{order_number}} in the template into a php variable? I can get my desired result with this php code:

$order_number = 281; 
get_metadata( 'post', $order_number, '_wp_wc_running_invoice_number', true );

How can I store the {order_number}} as a php variable to be used in the template or better yet, is there a more elegant way to show this data?

kilbot commented 4 years ago

Hi @atxcowboy, sorry for the late reply.

Please see the following Gist for an example of how you can customise the order_number: https://gist.github.com/kilbot/c9851f24b94c86c24d5ba7f26876a52c

Note: you will have to adjust the function to suit your needs but it should get you started. Also note that orders are cached locally so you should clear the local data if you make changes to the order data.