• Resolved jr75

    (@jr75)


    Hello,

    I have some orders that are created by API from a supplier and so the pdf invoices are not generated.
    There are created only if an email is sent to the customer it seems.

    I have found that if i use : wcpdf_get_invoice( $order_id, true ); it generates the invoice number but how do i do to generate the pdf itself in “wp-content/uploads/wpo_wcpdf/attachments” like the other in php ?

    Best regards,
    Jérémy

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Darren Peyou

    (@dpeyou)

    Thread Starter jr75

    (@jr75)

    Hello,

    Thanks for the quick answer, yes i found it already but it generates me the invoice number only and no trace whatsoever of the pdf file itself (i search everywhere in the worpdress).
    It seems it is generated only when a mail is sent to the customer.
    I tried this :
    $order = wc_get_order( $order_id );
    $invoice = wcpdf_get_document( ‘invoice’, $order, true );

    And before i was using this to generate the number:
    wcpdf_get_invoice( $order_id, true );

    Any idea how to mannually generate the pdf ? I have no error in the log also

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @jr75,

    If you don’t want to attach the PDF invoices, but still want to have access to the PDF files, the best way I can think of is to do using the Cloud storage feature, included in the Professional extension, to copying/uploading the PDF document to a folder in your server, using a similar settings like this:

    A screenshot that displays the Cloud storage area with SFTP sample settings

    By the way, if you have more questions about the Professional extension, please write us at [email protected], because www.remarpro.com doesn’t allow us to answer pre-sale questions or provide premium support for our paid plugins in these forums.

    Thread Starter jr75

    (@jr75)

    Ok thank you. So the pdf is only generated when the email is sent.
    So is this possible to send manually the email in php? (thoses orders are created from another software, so no emails are sent)

    Thread Starter jr75

    (@jr75)

    I found it finally!

    $invoice = wcpdf_get_document( ‘invoice’, $order, true );
    $pdf_data = $invoice->get_pdf();

    after i just have to create a file and put the pdf in it.
    Thanks for the time !

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Ok thank you. So the pdf is only generated when the email is sent.

    In the free version, the PDF invoices is only created automatically when it’s attached to an WooCommerce email notification, but you can always create it manually from the order list or the order details. You can read a better explanation in my reply here.

    So is this possible to send manually the email in php? (thoses orders are created from another software, so no emails are sent)

    Yes, you can! Also, you could use the Customer invoice / Order details, that is a manual email that you can send from the order details page. You need to select this email first in the Attach to setting, under WooCommerce?> PDF?Invoices?> Documents?> Invoice.

    I found it finally!

    I’m glad to hear that you managed to achieve what you wanted!

    FYI, we have a specific function to get the invoice: wcpdf_get_invoice()

    So, instead of get the invoice like this:
    $invoice = wcpdf_get_document( 'invoice', $order, true );

    …you can try this:
    $invoice = wcpdf_get_invoice( $order, true );

    By the way, if you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Generate manually the invoices’ is closed to new replies.