Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! You don’t need to use WP_Query, the invoice number and date are stored as postmeta. So with the post_id, you can get the invoice data with get_post_meta().

    $invoice_number = get_post_meta( $order_id, '_wcpdf_formatted_invoice_number', true );
    $invoice_date = get_post_meta( $order_id, '_wcpdf_invoice_date', true );

    There are also several built in functions that do this if the PDF invoice plugin is loaded (in the $wpo_wcpdf object):

    $invoice_number = $wpo_wcpdf->get_invoice_number();
    $invoice_date = $wpo_wcpdf->get_invoice_date();

    But that only works in the context of the plugin (when it has loaded an order).

    Hope that helps!
    Ewout

    Thread Starter undeuxtroisdev

    (@undeuxtroisdev)

    Thank you very much. It works very well !
    Thank you for your work.
    Olivier

    Plugin Contributor Ewout

    (@pomegranate)

    Your welcome! If you can spare a minute, I would really appreciate if you can leave me a review here on wordpress.org 🙂

    Thanks in advance and have a fantastic day!

    Ewout

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Getting invoice info with Order ID’ is closed to new replies.