• Resolved supportnsnoccom

    (@supportnsnoccom)


    I’ve got a cobbled together order management page (which has no wordpress/woocommerce includes/functions, all hand coded php/sql) but I want to be able to have a print/open packing slip link on the page.

    I’ve tried call the URL as per the woocommerce page but have no idea how to generate the _wpnonce code, everything I’ve done has come back with ‘not authorised’

    /wp-admin/admin-ajax.php?action=generate_wpo_wcpdf&document_type=packing-slip&order_ids=13355&_wpnonce=xxxxxxxxx

    Is there a ‘quick fix’ please?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @supportnsnoccom,

    You can create a packing slip for a specific order and return the packing slip object with the following code:

    $packing_slip = wcpdf_get_packing_slip( $order, true );

    You can then for instance return the PDF with the following:

    $packing_slip->get_pdf();

    I hope this helps you along!

    • This reply was modified 5 years, 3 months ago by kluver.
    Plugin Contributor Ewout

    (@pomegranate)

    To add to michaels answer – it’s not possible to generate the nonce remotely, as this is an internal verification code that WordPress uses and it expires every 12 or 24 hours. There is no api call to fetch this nonce AFAIK. However, there is still a way to enable access without the nonce, which is by enabling “Guest access” in the status tab of the PDF invoice settings and including the “Order Key” in the URL. See this topic: i want to generate pdf from api

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Create a packing slip link’ is closed to new replies.