Got it on my own. I also use the webtoffee plugin “packing list, shipping labels, invoice,…” and I just added a custom field using the functions.php .
NOT THE ADVANCED META KEYS ! They don’t work, when you just need the original order id!
add_filter('wf_pklist_alter_find_replace','wf_pklist_add_values_for_custom_placeholders',10,5);
function wf_pklist_add_values_for_custom_placeholders($find_replace,$template_type,$order,$box_packing,$order_package)
{
if($template_type=='invoice')
{
$wc_version=(WC()->version<'2.7.0') ? 0 : 1; $order_id = ($wc_version==0 ? $order->id : $order->get_id());
$find_replace['[wfte_custommeta1]']=get_post_meta($order_id,'_post_title',true);
}
return $find_replace;
}
This is the original code where you could create as many meta_keys as you want by simply duplicating the line “$find_replace….” . But in my case I needed this:
add_filter('wf_pklist_alter_find_replace','wf_pklist_add_values_for_custom_placeholders',10,5);
function wf_pklist_add_values_for_custom_placeholders($find_replace,$template_type,$order,$box_packing,$order_package)
{
if($template_type=='invoice')
{
$wc_version=(WC()->version<'2.7.0') ? 0 : 1; $order_id = ($wc_version==0 ? $order->id : $order->get_id());
$find_replace['[wfte_custommeta_b]']=$order_id;
}
return $find_replace;
}
That’s it. Just this line:
$find_replace[‘[wfte_custommeta_b]’]=$order_id;
I’m going to stick with your topic. When creating a label, the WooCommerce internal order number is always used in the reference field. However, we continuously generate a different public order number. Do you have any idea how we can replace the internal one with ours?
Tbh I just had luck having a plan B with the invoices. For the dhl plugin I can only suggest that you might replace the order number with your number be writing your own hook in the functions.php . This shouldn’t be a big Problem but I’m not good enough to write a proper hook with such a wide range of actions….I don’t want to be responsible for any problems 🙁
Ok, thanks for your answer. I’ll have a look in the code and see how far I get.