• Resolved kontur

    (@kontur)


    I’m having trouble getting the hooks described in the help to work.

    With this code:

    error_log("custom hooks");
    
    add_filter('wf_pklist_alter_package_item_quantiy', 'wt_pklist_package_item_quantiy', 10, 5);
    
    function wt_pklist_package_item_quantiy($item_quantity, $template_type, $_product, $item, $order) {
    
    error_log("custom quantity");
    
    return "Test quantity";
    
    }
    
    add_filter('wf_pklist_alter_product_name', 'wt_pklist_new_prodct_name', 10, 5);
    
    function wt_pklist_new_prodct_name($order_item_name, $template_type, $_product, $order_item, $order)
    
    {
    
    error_log("custom name");
    
    return "Test product name";
    
    }

    …I am seeing the first error log “custom hooks” but the others never get triggered and the PDFs do not change.

    What am I missing here?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi kontur,

    Thanks for reaching out.

    We would like to convey that the “wf_pklist_alter_product_name” filter works with the Invoice and Dispatch label documents only. Kindly confirm if that’s the case.

    Thread Starter kontur

    (@kontur)

    Yep, trying to get this to work on invoices. I am also using the checkbox active to use latest settings for older invoices, so I suppose they should regenerate always?

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi kontur,

    The code snippet will work with the older invoice even when “Use latest settings for invoice” is enabled. The product name displayed “Test product name” when tested on our end.

    Thread Starter kontur

    (@kontur)

    Hmm, thanks for testing. This is very odd.

    I can see the hooks being registered with debug bar:

    But here in this preview I can see the “custom hooks” error log triggering, but not the ones of this plugin. I’ve tested with my code from above being at the start of functions.php:

    Why isn’t the name updating then?

    Thread Starter kontur

    (@kontur)

    Okay. I see. It doesn’t update this preview, but only when you click the download invoice button again.

    No idea as to why this initially didn’t update, because I did test with clicking invoices.

    • This reply was modified 6 months ago by kontur.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Customisation hooks don’t see to trigger’ is closed to new replies.