• Resolved dcrowthe

    (@dcrowthe)


    When trying to create a PDF Invoice or PDF Packing slip, I am getting the following errors:

    PDF Invoice:

    Fatal error: Call to a member function shipping_address() on null

    /home/customer/www/…/public_html/wp-content/themes/bookshop/woocommerce/pdf/Custom/invoice.php (8)

    #0 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(976): include()
    #1 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(879): WPO\WC\PDF_Invoices\Documents\Order_Document->render_template(‘/home/customer/…’, Array)
    #2 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(834): WPO\WC\PDF_Invoices\Documents\Order_Document->get_html()
    #3 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(901): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf()
    #4 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(466): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf(‘inline’)
    #5 /home/customer/www/…/public_html/wp-includes/class-wp-hook.php(310): WPO\WC\PDF_Invoices\Main->generate_pdf_ajax(”)
    #6 /home/customer/www/…/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(”, Array)
    #7 /home/customer/www/…/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #8 /home/customer/www/…/public_html/wp-admin/admin-ajax.php(188): do_action(‘wp_ajax_generat…’)
    #9 {main}

    PDF Packing Slip:

    Fatal error: Call to a member function shipping_address() on null

    /home/customer/www/…/public_html/wp-content/themes/bookshop/woocommerce/pdf/Custom/packing-slip.php (8)

    #0 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(976): include()
    #1 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(879): WPO\WC\PDF_Invoices\Documents\Order_Document->render_template(‘/home/customer/…’, Array)
    #2 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(834): WPO\WC\PDF_Invoices\Documents\Order_Document->get_html()
    #3 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(901): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf()
    #4 /home/customer/www/…/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(466): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf(‘inline’)
    #5 /home/customer/www/…/public_html/wp-includes/class-wp-hook.php(310): WPO\WC\PDF_Invoices\Main->generate_pdf_ajax(”)
    #6 /home/customer/www/…/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(”, Array)
    #7 /home/customer/www/…/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #8 /home/customer/www/…/public_html/wp-admin/admin-ajax.php(188): do_action(‘wp_ajax_generat…’)
    #9 {main}

    Name of the impacted domain truncated to …

    Support Troubleshooting Notes:

    1. All plugins and WordPress are at current versions
    2. All plugins have been deactivated (except woocommerce and PDF Invoices & Packing Slips for WooCommerce) to see if it was a plugin conflict and the problem still occured.
    3. The client has auto-update enabled for the plugin
    4. The client reported that the problem started with orders received 3-4 weeks ago.

    The page I need help with: [log in to see the link]

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

    (@yordansoares)

    Hi @dcrowthe,

    This issue is happening because you are using a very outdated custom PDF template.

    Please note that in the last release, 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, please follow these steps to update an outdated custom PDF template generated from our default ‘Simple’ template*:

    1. Replace the whole code of the html-document-wrapper.php file with the current one you will find here.
    2. Open the invoice.php file, and do the following:
      1. Replace the first like with this one:
        <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
      2. Replace every concurrence of $wpo_wcpdf with $this
      3. Replace every concurrence of 'wpo_wcpdf' (include the single quotes in the search & replace routine!) with 'woocommerce-pdf-invoices-packing-slips': This is the text domain which is needed in order for translations to work.
    3. If need it, repeat the steps of the 2nd point for the packing slip too.

    * If your custom PDF template was generated from a premium template, please contact us by [email protected].

    Thread Starter dcrowthe

    (@dcrowthe)

    Thank you so much, I opted to switch from the custom template to the simple template and that fixed the problem. Thanks so much for the quick response and the solution! Much appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal error: Call to member function shipping_address() on null’ is closed to new replies.