• Resolved hardyzbest

    (@hardyzbest)


    I started a new range with custom order numbers but the DHL shipping plugin always uses the order ID’s which creates a complete mess.

    Any chance to bring up a custom field for custom reference notes? Or atleast a hook for the function or something like that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter hardyzbest

    (@hardyzbest)

    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;

    matth1as

    (@matthiasurz)

    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?

    Thread Starter hardyzbest

    (@hardyzbest)

    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 ??

    matth1as

    (@matthiasurz)

    Ok, thanks for your answer. I’ll have a look in the code and see how far I get.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Any option to replace the reference field?’ is closed to new replies.