Setting: Keep PDF on server #
- Requirement: PDF Invoices & Packing Slips for WooCommerce – Professional.
- Path: WooCommerce > PDF Invoices > Documents, select a document type, then scroll down to Keep PDF on server.
With this ‘Keep PDF on server’ option enabled for a certain document type, the documents will be saved in the ‘archive‘ folder . Whenever the document is requested for viewing or downloading, it should be pulled from this archive folder
Now, documents that were saved in the archive folder will be loaded, instead of the pdf being regenerated dynamically using the WooCommerce order information. This ensures the documents are immutable.
Archive folder location #
The pdf documents will be saved at the following path on your server’s WordPress installation:
- wp-content/uploads/wpo_wcpdf_xxx/archive.
Note: The ‘xxx’ represents a sequence of random numbers.
When migrating the site, it is important to place these saved documents back into this generated ‘archive‘ folder on the new site, with the same filename that is stored in the order meta under:
_wpo_wcpdf_invoice_archived
As shown in the image above, the PDF’s filename would need to be ‘invoice-134-wc_order_GCld2yxtCUDml.pdf‘ in the new environment.
Please keep in mind that the meta-key shown above is only for invoices and will be slightly different for other document types:
- Packing Slip:
_wpo_wcpdf_packing_slip_archived
- Proforma Invoice:
_wpo_wcpdf_proforma_invoice_archived
- Receipt:
_wpo_wcpdf_receipt_archived
- Credit Note:
_wpo_wcpdf_credit_note_archived
The information above can easily be visualized via the WooCommerce Order Details screen at WooCommerce > Orders > Order #xxx, if the WooCommerce Store Toolkit plugin is installed. This will be located in the new Order Post Meta table.