• Resolved borish1

    (@borish1)


    Hi, trying to find a way to easily regenerate invoices for all the current orders that we have. The problem was that we had “Enable automatic cleanup” activated. Currently, only invoices from the last 7 days exist. We need them all.

    Is there a function that I could trigger via functions.php for this to regenerate easily?

    • This topic was modified 4 years, 1 month ago by borish1.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Boris,
    The ‘attachments’ folder is not meant as an archive, merely as a temporary folder for the email attachments. Manually generated invoices that are not sent by email will not end up in the attachments folder. With our Professional extension we offer a bulk exporter that will let you download zip file with all the PDF documents for a specific date range.

    Thread Starter borish1

    (@borish1)

    Hey Ewout,

    Thank you for the fast response.

    I understand that but we would need to keep the pdf files inside the WordPress as we are mounting the ERP system with the store. The ERP system needs to have access to all the invoices so I thought just to generate them all inside the /attachments/ folder and keep the automatic cleanup turned off. Via htaccess IP can be whitelisted to access them as I see.

    So the main problem would be how to handle manual orders where you generate a manual invoice that won’t get saved inside attachments?

    Do you have a better approach with your plugin that I could achieve?

    I could do a custom implementation if there is a solution for this I just need some keypoints where to look.

    • This reply was modified 4 years, 1 month ago by borish1.
    • This reply was modified 4 years, 1 month ago by borish1.
    Plugin Contributor Ewout

    (@pomegranate)

    You could use the wpo_wcpdf_pdf_created hook to store all PDF documents in a location of your choice as soon as it gets generated, here’s a starter:

    
    add_action( 'wpo_wcpdf_pdf_created', function( $pdf_data, $document ){
    	$filename = $document->get_filename();
    	// store the $pdf_data into a file using file_put_contents
    }, 10, 2 );
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Easiest way to regenerate 5k+ invoices for orders’ is closed to new replies.