Title: Invoice throws error
Last modified: February 26, 2020

---

# Invoice throws error

 *  Resolved [KatrineDS](https://wordpress.org/support/users/katrineds/)
 * (@katrineds)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/invoice-throws-error/)
 * Hi,
    I get an error when I try do open invoices. The packing slips works fine.
   Det error I get:
 *     ```
       Fatal error: Call to a member function get_id() on boolean
       #0 /customers/a/f/9/stuhrling.dk/httpd.www/wp-includes/class-wp-hook.php(288): Vc_Aino_Order->add_pdf_information('22474405', Object(WPO\WC\PDF_Invoices\Documents\Invoice))
       #1 /customers/a/f/9/stuhrling.dk/httpd.www/wp-includes/plugin.php(206): WP_Hook->apply_filters('22474405', Array)
       #2 /customers/a/f/9/stuhrling.dk/httpd.www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document-methods.php(155): apply_filters('wpo_wcpdf_billi...', '22474405', Object(WPO\WC\PDF_Invoices\Documents\Invoice))
       #3 /customers/a/f/9/stuhrling.dk/httpd.www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document-methods.php(158): WPO\WC\PDF_Invoices\Documents\Order_Document_Methods->get_billing_phone()
       #4 /customers/a/f/9/stuhrling.dk/httpd.www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/Simple/invoice.php(39): WPO\WC\PDF_Invoices\Documents\Order_Document_Methods->billing_phone()
       #5 /customers/a/f/9/stuhrling.dk/httpd.www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(738): include('/customers/a/f/...')
       #6 /customers/a/f/9/stuhrling.dk/httpd.www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(642): WPO\WC\PDF_Invoices\Documents\Order_Document->render_template('/customers/a/f/...', Array)
       #7 /customers/a/f/9/stuhrling.dk/httpd.www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(624): WPO\WC\PDF_Invoices\Documents\Order_Document->get_html()
       #8 /customers/a/f/9/stuhrling.dk/httpd.www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(660): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf()
       #9 /customers/a/f/9/stuhrling.dk/httpd.www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(337): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf('inline')
       #10 /customers/a/f/9/stuhrling.dk/httpd.www/wp-includes/class-wp-hook.php(288): WPO\WC\PDF_Invoices\Main->generate_pdf_ajax('')
       #11 /customers/a/f/9/stuhrling.dk/httpd.www/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters('', Array)
       #12 /customers/a/f/9/stuhrling.dk/httpd.www/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
       #13 /customers/a/f/9/stuhrling.dk/httpd.www/wp-admin/admin-ajax.php(175): do_action('wp_ajax_generat...')
       #14 {main}
       ```
   
 * What could be the error?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/invoice-throws-error/#post-12482067)
 * This appears to be caused by a third party plugin with a class `Wc_Aino_Order`(
   this error was reported by someone else [here](https://wordpress.org/support/topic/fatal-error-call-to-a-member-function-get_id-on-boolean-2/)
   but unfortunately without follow-up)
 * You could try turning off plugins that you think may be related (perhaps with
   something like “Aino” in their name) or temporarily switch to a different theme.
 * Let us know what you find!
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/invoice-throws-error/#post-12626377)
 * After receiving another report of this error I digged a little further and found
   the offending plugin: [PostNord Delivery Checkout](https://wordpress.org/plugins/vconnect-postnord-delivery-checkout/)
 * The error was already [reported in that plugin support forum](https://wordpress.org/support/topic/this-plugin-breaks-another-package-slip-plugin/)
   too, but unfortunately the developers (@vconnect / [@vconnectmodules](https://wordpress.org/support/users/vconnectmodules/))
   have not responded yet.
 * The issue is caused by legacy code in their plugin, written for PDF Invoices 
   1.X and not compatible with PDF Invoices 2.X (from 2017):
 *     ```
       add_filter('wpo_wcpdf_billing_phone', array($this, 'add_pdf_information'), 10, 3);
       function add_pdf_information($address) {
           global $wpo_wcpdf;
   
           $order_meta = get_post_meta($wpo_wcpdf->export->order->get_id());
   
           if ($order_meta['_vc_aio_options']) {
   
               foreach (unserialize($order_meta['_vc_aio_options'][0]) as $key => $vc_aio_option) {
                   if(empty($vc_aio_option['hidden'])) {
                       $address .= $vc_aio_option['label'] . ': ' . $vc_aio_option['value'] . '<br />';
                   }
               }
           }
   
           return $address;
       }
       ```
   
 * To make this compatible with version 2.0+ it needs to be altered, first the filter
   arguments (2 instead of 3):
 *     ```
       add_filter('wpo_wcpdf_billing_phone', array($this, 'add_pdf_information'), 10, 2);
       ```
   
 * and then the function itself:
 *     ```
       function add_pdf_information($phone_number, $document = null ) {
           if ( !empty($document->order) && $vc_aio_options = $document->order->get_meta('_vc_aio_options') ) {
               $vc_aio_options = maybe_unserialize( $vc_aio_options );
               if (empty($vc_aio_options) || !is_array($vc_aio_options)) {
                   return $phone_number
               }
   
               foreach ($vc_aio_options as $key => $vc_aio_option) {
                   if(empty($vc_aio_option['hidden'])) {
                       $phone_number .= $vc_aio_option['label'] . ': ' . $vc_aio_option['value'] . '<br />';
                   }
               }
           }
   
           return $phone_number;
       }
       ```
   
 * A few notes:
    - The code hooks into the `wpo_wcpdf_billing_phone` filter, which means that
      it is only added to the PDF when the “Show phone number” option is activated
      in the settings. It may be more appropriate to hook into the `wpo_wcpdf_after_billing_address`
      action ([source](https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/v2.4.7/templates/Simple/invoice.php#L34)).
    - I haven’t tested the above code but this should be enough for the developers
      to implement a solution
    - Two possible **temporarily solutions** (that don’t require any change in code):
      1) Disable the “phone” option in the invoice settings and enable the “always
      use most current settings” option or 2) Enable “Legacy mode” on the Status
      tab of the plugin settings

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Invoice throws error’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-packing-slips/assets/icon-256x256.
   png?rev=2189942)
 * [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/)

## Tags

 * [PDF invoice](https://wordpress.org/support/topic-tag/pdf-invoice/)
 * [Postnord](https://wordpress.org/support/topic-tag/postnord/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ewout](https://wordpress.org/support/users/pomegranate/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/invoice-throws-error/#post-12626377)
 * Status: resolved