• Resolved moeclone

    (@moeclone)


    Hello.
    please tell me how to create an invoice for payment in code?

    $invoice = new WCPDF_Invoice($order);
    $invoice->generate_invoice()

    if you use this approach, then WCPDF_Invoice is undefined type.

    What is the correct way to make it possible to create an invoice?

    Or is it possible to set up an invoice to be created automatically and sent to the client after a certain period through the control panel? free version of the plugin installed

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor dwpriv

    (@dwpriv)

    You could try this snippet to create an invoice if it doesn’t exist

    $invoice = wcpdf_get_document( 'invoice', $order, true );
    Thread Starter moeclone

    (@moeclone)

    please tell me where I can read about this? is there documentation?

    Thread Starter moeclone

    (@moeclone)

    How can I then get a link to this invoice to send it to the client?

    Plugin Contributor dwpriv

    (@dwpriv)

    There isn’t a documentation for this specifically.

    You can create a download link and share it with a snippet like this

    $pdf_url = admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order->get_id() . '&order_key=' . $order->get_order_key() );
    
    echo '<p><a href="' . $pdf_url. '>Download your invoice</a></p>';

    You can use this with the function to print the download link.

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

The topic ‘create invoice in code’ is closed to new replies.