Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! This is possible, but it does require custom scripting. If you only need to reset the numbering and don’t necessarily need the PDF documents, then you could just loop through all orders and reset the ‘_wcpdf_invoice_number’ meta field. If you actually need the PDF files too, it’s a bit more difficult, and certainly a strain on your server. In that same loop, you’d have to call the PDF data and save it to a file with something like this:

    global $wpo_wcpdf;
    $pdf_data = $wpo_wcpdf->export->get_pdf( 'invoice', (array) $order_id );
    $pdf_path = '/some/path/on/your/server/';
    $pdf_filename = $wpo_wcpdf->export->build_filename( 'invoice', (array) $order_id, 'attachment' );
    
    file_put_contents ( $pdf_path . $pdf_filename, $pdf_data );

    But it’s not a simple task…

    Good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Regenerate invoice’ is closed to new replies.