Replies: 0
Hello and thanks for a useful plugin,
The plugin works fine for what we want it to do, which is generate an invoice PDF upon order completion (and append a two page PDF to that invoice).
This is the only PDF we need. Email only is enough for refunds.
When I refund an order, I get a blank page. If I access the backend by tying its address in the address bar, I see that the order was refunded correctly. Refund email is being sent and received normally. So everything seems to be working, except for the fact that I get a blank page after changing order status to “refunded” instead of being taken back to the order page.
In the log I get the following error:
2018-08-30T17:58:49+00:00 CRITICAL Uncaught Error: Call to undefined method WC_Order_Refund::get_order_number() in /home/2/s/slankemat/shop/wp-content/plugins/woocommerce-pdf-invoices/includes/abstracts/abstract-invoice.php:231
Stack trace:
#0 /home/2/s/slankemat/shop/wp-content/plugins/woocommerce-pdf-invoices-premium/includes/class-credit-note.php(531): BEWPI_Abstract_Invoice->get_next_invoice_number()
#1 /home/2/s/slankemat/shop/wp-content/plugins/woocommerce-pdf-invoices-premium/includes/class-credit-note.php(355): BEWPIP_Credit_Note->generate()
#2 /home/2/s/slankemat/shop/wp-includes/class-wp-hook.php(286): BEWPIP_Credit_Note::generate_credit_note_for_refund(217, 228)
#3 /home/2/s/slankemat/shop/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
#4 /home/2/s/slankemat/shop/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#5 /home/2/s/slankemat/shop/wp-content/plugins/woocommerce/includes/wc-order-functions.php(598): do_action('woocommerce_ord...', 217, 228)
#6 /home/2/s/slankemat/shop/wp-content/plugins/woocommerc
It seems it’s failing while trying to generate a credit note, but I don’t need one.
I am using a custom template in uploads/woocommerce-pdf-invoices/templates/invoice/simple but it is working fine when generating the regular invoice.
Possibly relevant: my custom PDF template’s header includes the following code (We wanted the order info in the header). It’s not causing any problems when generating the regular invoices, though.
<td>
<?php
printf( __( 'Ordrenummer: %s', 'woocommerce-pdf-invoices' ), $invoice->get_formatted_number() );
printf( '<br />' );
printf( __( 'Bestillingsdato: %s', 'woocommerce-pdf-invoices' ), $invoice->get_formatted_order_date() );
printf( '<br />' );
printf( __( 'Bestillingsnummer: %s', 'woocommerce-pdf-invoices' ), $order->get_order_number() );
if ( $payment_gateway ) {
printf( '<br />' );
printf( __( 'Betalingsmåte: %s', 'woocommerce-pdf-invoices' ), $payment_gateway->get_title() );
// Get PO Number from 'WooCommerce Purchase Order Gateway' plugin.
if ( 'woocommerce_gateway_purchase_order' === $payment_gateway->get_method_title() ) {
$po_number = $templater->get_meta( '_po_number' );
if ( $po_number ) {
printf( '<br />' );
printf( __( 'Purchase Order Number: %s', 'woocommerce-pdf-invoices' ), $po_number );
}
}
}
// Get VAT Number from 'WooCommerce EU VAT Number' plugin.
$vat_number = $templater->get_meta( '_vat_number' );
if ( $vat_number ) {
printf( '<br />' );
printf( __( 'VAT Number: %s', 'woocommerce-pdf-invoices' ), $vat_number );
}
?>
</td>
- This topic was modified 6 minutes ago by truqmedia.