How to Fix PDF Invoice Date Display Issues in WooCommerce
Content
If the delivery or order date in your WooCommerce PDF invoice is displaying incorrectly—such as showing one day later than the date selected in your admin—you're not alone. This is a common issue that often stems from a conflict between how different plugins handle date formatting and time zones.
Why Does This Happen?
This discrepancy typically occurs when a third-party plugin (like a delivery date plugin) hooks into the PDF invoice to add its own data. The 'PDF Invoices & Packing Slips for WooCommerce' plugin itself does not generate these custom date strings. If the other plugin uses a different function to format the date (for example, using PHP's date() instead of WordPress's timezone-aware wp_date() function), the date can appear offset due to server timezone settings.
How to Troubleshoot and Resolve the Issue
1. Contact the Other Plugin's Support
The most straightforward solution is to contact the support team for the plugin that provides the date functionality (e.g., 'Order Delivery Date Pro for WooCommerce'). They are best positioned to know how their date information is added to the PDF and can advise on a fix. Ask them specifically which function they use to output the date in the PDF document.
2. Investigate with Code (For Developers)
If you have coding skills, you can investigate the source of the problem yourself. You need to locate the code that adds the delivery date to the PDF invoice. This code is likely using one of the PDF plugin's action hooks, such as wpo_wcpdf_after_order_data.
Once you find the function, check if it uses date() or gmdate(). These functions do not account for the WordPress timezone setting. The fix is to replace them with the WordPress function wp_date(), which correctly formats the date based on your site's timezone.
// Example of incorrect code that might cause an offset
echo date( 'Y-m-d', $timestamp );
// Corrected code using the WordPress timezone
echo wp_date( 'Y-m-d', $timestamp );
3. Double-Check Your Timezone Settings
While the issue is most likely in the other plugin's code, it's always good to confirm your WordPress timezone setting is correct. You can find this in your WordPress admin under Settings > General.
Conclusion
An offset date in your PDF invoice is almost always a conflict with another plugin's custom code. The solution involves reaching out to that plugin's developers or modifying their code to use WordPress's proper timezone functions. By following these steps, you can ensure the dates on your invoices accurately reflect your and your customers' expectations.
Related Support Threads Support
-
wrong date in the pdfhttps://wordpress.org/support/topic/wrong-date-in-the-pdf/
-
Amelia Booking Details in PDF Invoicehttps://wordpress.org/support/topic/amelia-booking-details-in-pdf-invoice/
-
Query related to PDF Invoices & Packing Slips for WooCommercehttps://wordpress.org/support/topic/query-related-to-pdf-invoices-packing-slips-for-woocommerce/
-
Support for Purchase Invoiceshttps://wordpress.org/support/topic/support-for-purchase-invoices/
-
Invoice relatedhttps://wordpress.org/support/topic/invoice-related/
-
Invoice link in Woo order complete emailhttps://wordpress.org/support/topic/invoice-link-in-woo-order-complete-email/
-
PDF issue with recurring orders (subscriptions)https://wordpress.org/support/topic/pdf-issue-with-recurring-orders-subscriptions/
-
WooCommerce Product Bundleshttps://wordpress.org/support/topic/woocommerce-product-bundles-7/
-
Add Booking Start & End Date To Invoice & Packing Slipshttps://wordpress.org/support/topic/add-booking-start-end-date-to-invoice-packing-slips/
-
auto generate pdf when creating credit noteshttps://wordpress.org/support/topic/auto-generate-pdf-when-creating-credit-notes/
-
Details from Bookings Plugin on PDF Invoicehttps://wordpress.org/support/topic/details-from-bookings-plugin-on-pdf-invoice/
-
Template locationhttps://wordpress.org/support/topic/template-location-2/
-
Fetch PDF invoice using APIhttps://wordpress.org/support/topic/fetch-pdf-invoice-using-api/
-
Using Different PDF Invoice Templates for Different Product Post Typeshttps://wordpress.org/support/topic/using-different-pdf-invoice-templates-for-different-product-post-types/
-
Insert link in custom mailhttps://wordpress.org/support/topic/insert-link-in-custom-mail/
-
PDF Invoices in Hebrew Language with WooCommerce Pluginhttps://wordpress.org/support/topic/pdf-invoices-in-hebrew-language-with-woocommerce-plugin/
-
Showing susbscription informations on my invoicehttps://wordpress.org/support/topic/showing-susbscription-informations-on-my-invoice/
-
Add Bank Details when Payment is Purchase Orderhttps://wordpress.org/support/topic/add-bank-details-when-payment-is-purchase-order/
-
Can I also print the invoice bill with A6 thermal printer?https://wordpress.org/support/topic/can-i-also-print-the-invoice-bill-with-a6-thermal-printer/
-
Invoice previewhttps://wordpress.org/support/topic/invoice-preview/
-
Display order meta items (from WP Amelia plugin)https://wordpress.org/support/topic/display-order-meta-items-from-wp-amelia-plugin/
-
Link to download PDF from thank you page no longer workshttps://wordpress.org/support/topic/link-to-download-pdf-from-thank-you-page-no-longer-works/
-
Woo Download URLhttps://wordpress.org/support/topic/woo-download-url/
-
Conditional PDF Delivery by Payment Method in WooCommercehttps://wordpress.org/support/topic/conditional-pdf-delivery-by-payment-method-in-woocommerce/
-
Is there a way to show payment amount and zero balance?https://wordpress.org/support/topic/is-there-a-way-to-show-payment-amount-and-zero-balance/
-
Print digital producthttps://wordpress.org/support/topic/print-digital-product/
-
Add Custom blocks based on Payment Methodhttps://wordpress.org/support/topic/add-custom-blocks-based-on-payment-method/
-
WooCommerce Bookings Official Plugin Supporthttps://wordpress.org/support/topic/woocommerce-bookings-official-plugin-support/
-
WooCommerce as MU-pluginhttps://wordpress.org/support/topic/woocommerce-as-mu-plugin/
-
Woocommerce sending old default templatehttps://wordpress.org/support/topic/woocommerce-sending-old-default-template/
-
PDF invoices for WooCommerce Subscriptions Renewal Ordershttps://wordpress.org/support/topic/pdf-invoices-for-woocommerce-subscriptions-renewal-orders/
-
Multiple Shipping Addresses for wpovernight barcodehttps://wordpress.org/support/topic/multiple-shipping-addresses-for-wpovernight-barcode/
-
Paid Membership Pro User Fieldshttps://wordpress.org/support/topic/paid-membership-pro-user-fields/
-
customs form from the invoice datahttps://wordpress.org/support/topic/customs-form-from-the-invoice-data/
-
PDF Invoices & Packing Slips for WooCommercehttps://wordpress.org/support/topic/pdf-invoices-packing-slips-for-woocommerce/
-
Invoice PDF link after payment in checkout pagehttps://wordpress.org/support/topic/invoice-pdf-not-attach/
-
Show Woocommerce booking content in inclusivehttps://wordpress.org/support/topic/show-woocommerce-booking-content-in-inclusive/
-
Is it possible to display Yith booking and appointment plugins infohttps://wordpress.org/support/topic/is-it-possible-to-display-yith-booking-and-appointment-plugins-info/
-
Simply print an order?https://wordpress.org/support/topic/simply-print-an-order/
-
Pay invoice by credit cardhttps://wordpress.org/support/topic/pay-invoice-by-credit-card/
-
Customizing Invoice Number Based on Client Locationhttps://wordpress.org/support/topic/customizing-invoice-number-based-on-client-location/
-
Invoice with PayPalhttps://wordpress.org/support/topic/invoice-with-paypal-2/
-
Klaviyo Integrationhttps://wordpress.org/support/topic/klaviyo-integration-6/
-
Bookings details missing in invoicehttps://wordpress.org/support/topic/bookings-details-missing-in-invoice/
-
WooCommerce PDF Invoices & Packing Slips Thermal Printerhttps://wordpress.org/support/topic/woocommerce-pdf-invoices-packing-slips-thermal-printer-2/