Switching from other invoice plugin (Invoices for WooCommerce / Bas Elbers)
-
Hi,
I use the – no longer maintained – “Invoices for WooCommerce Premium” plugin (by Bas Elbers) and I’d like to switch to the premium version of WooCommerce PDF Invoices & Packing Slips.
I downloaded the free version of your plugin on a test installation and try to show the invoices already generated by the previous plugin without having to keep it activated.
I need an access to the existing invoices on the admin side (orders list page and edit order page) as well as the “My account” page in which the users have access to their invoices.My issue is very similar to this one.
I was able to retrieve the meta_key used for the invoice number (
_bewpi_invoice_number
) as well as the meta_key for the date of the invoice (_bewpi_invoice_date
).I’ve used this code snippet you provided on the topic above (edited with my meta keys) with no success :
/** * WooCommerce PDF Invoices & Packing Slips: * Migrate invoice numbers from YITH WooCommerce PDF Invoice and Shipping List Premium */ add_filter( 'wpo_wcpdf_invoice_get_date', function( $date, $document ) { if ( $document->get_type() == 'invoice' && $order = $document->order ) { // Get invoice date if ( $legacy_date = $order->get_meta('_bewpi_invoice_date') ) { $date = new \WC_DateTime( "@{$legacy_date}", new \DateTimeZone( 'UTC' ) ); $document->set_date( $date ); } } return $date; }, 10, 2 ); add_filter( 'wpo_wcpdf_external_invoice_number_enabled', '__return_true' ); add_filter( 'wpo_wcpdf_external_invoice_number', function( $number, $document ) { if ( ! empty( $document->order ) ) { // Get invoice formatted number $number = $document->order->get_meta( '_bewpi_invoice_number' ); // if $number is empty, the plugin will generate a new number } return $number; }, 10, 2 );
If I try to generate an invoice by clicking the invoice icon on the orders list page, no invoice is generated and I have this error :
Exception: DateTime::__construct(): Failed to parse time string (@2022-03-25 15:32:37) at position 8 (-): Double timezone specification
What am I doing wrong ?
I use WordPress 5.9.4, Woocommerce 6.3.1 and the Php version is 8.0.22
Thanks !
- The topic ‘Switching from other invoice plugin (Invoices for WooCommerce / Bas Elbers)’ is closed to new replies.