• Resolved webesi

    (@webesi)


    I am experiencing a critical error when attempting to view an invoice using the PDF Invoices & Packing Slips plugin on our WooCommerce site. The error occurs specifically when accessing a particular invoice.

    Fatal error: Call to a member function custom_field() on null/home/customer/www/parroquiadelcarmen.es/public_html/wp-content/themes/Divi-child/functions.php (108)#0 /home/customer/www/parroquiadelcarmen.es/public_html/wp-includes/class-wp-hook.php(326): incluir_nif_en_factura(‘MARIA TERESA GU…’) #1 /home/customer/www/parroquiadelcarmen.es/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(‘MARIA TERESA GU…’, Array) #2 /home/customer/www/parroquiadelcarmen.es/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document-methods.php(93): apply_filters(‘wpo_wcpdf_billi…’, ‘MARIA TERESA GU…’, Object(WPO\WC\PDF_Invoices\Documents\Invoice)) #3 /home/customer/www/parroquiadelcarmen.es/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document-methods.php(102): WPO\WC\PDF_Invoices\Documents\Order_Document_Methods->get_billing_address() #4 /home/customer/www/parroquiadelcarmen.es/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/Simple/invoice.php(42): WPO\WC\PDF_Invoices\Documents\Order_Document_Methods->billing_address() #5 /home/customer/www/parroquiadelcarmen.es/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(1138): include(‘/home/customer/…’) #6 /home/customer/www/parroquiadelcarmen.es/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(982): WPO\WC\PDF_Invoices\Documents\Order_Document->render_template(‘/home/customer/…’, Array) #7 /home/customer/www/parroquiadelcarmen.es/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(937): WPO\WC\PDF_Invoices\Documents\Order_Document->get_html() #8 /home/customer/www/parroquiadelcarmen.es/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(1004): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf() #9 /home/customer/www/parroquiadelcarmen.es/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(580): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf(‘inline’) #10 /home/customer/www/parroquiadelcarmen.es/public_html/wp-includes/class-wp-hook.php(324): WPO\WC\PDF_Invoices\Main->generate_document_ajax(”) #11 /home/customer/www/parroquiadelcarmen.es/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array) #12 /home/customer/www/parroquiadelcarmen.es/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #13 /home/customer/www/parroquiadelcarmen.es/public_html/wp-admin/admin-ajax.php(188): do_action(‘wp_ajax_generat…’) #14 {main}

    Additionally, in the plugin preview settings, it displays a “200: parsererror.”

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Could you please share the code of the function located in /wp-content/themes/Divi-child/functions.php (line 108), so I can update it for it to work correctly again?

    Thread Starter webesi

    (@webesi)

    line 108:

    $wpo_wcpdf->custom_field( 'NIF', 'NIF: ' );

    Full code:

    add_filter( 'wpo_wcpdf_billing_address', 'incluir_nif_en_factura' );
     
    function incluir_nif_en_factura( $address ){
      global $wpo_wcpdf;
     
      echo $address . '<p>';
      $wpo_wcpdf->custom_field( 'NIF', 'NIF: ' );
      echo '</p>';
    }
    • This reply was modified 1 year, 3 months ago by webesi.
    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for sharing that code, @webesi:

    This issue is happening because you are using a very outdated code. Please note that in v3.6.3 we have deleted legacy code that we were maintaining for years. Therefore, since the global variable?$wpo_wcpdf?no longer exists, this is returning errors in those methods called through it.

    That said, I have updated your code to make it work again:

    /**
     * PDF Invoices & Packing Slips for WooCommerce:
     * Incluir NIF en los documentos PDF
     */
    add_filter( 'wpo_wcpdf_billing_address', function( $address, $document ) {
    	if ( ( $order = $document->order ) && ( $nif = $order->get_meta( 'NIF' ) ) ) {
    		$address .= sprintf( '<p>NIF: %s</p>', $nif ); 
    	}
    	return $address;
    }, 10, 2 );
    Thread Starter webesi

    (@webesi)

    Thank you! It is now working properly

    Plugin Contributor Yordan Soares

    (@yordansoares)

    I’m happy to hear that, @webesi!

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and do not hesitate to contact us again if you have any other question!

    We have the same issue with WooCommerce/Polestar theme not sending or downloading PDFs since the update a few days ago. WE are using Version 3.7.5 – click on the PDF button and we get a “page not found” error. I trided the function code above but on luck.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi, @calderwood:

    Could you please create a new topic with your question? This way we keep the forum organized and avoid annoying the thread starter user with email notifications unrelated to their query. Please note that yours could be a totally different issue.

    I’ll answer you there! ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PDF Invoices Plugin Error in WooCommerce’ is closed to new replies.