وردپرس

Reporting fatal error | WordPress.org


We’re using this plugin in conjunction with https://wordpress.org/plugins/print-invoices-packing-slip-labels-for-woocommerce/.

We’re using Woo’s API to programmatically create orders; however, these calls are failing due to the following error:

[28-Aug-2024 21:05:10 UTC] PHP Fatal error:  Uncaught Error: Call to a member function children() on null in /home/example/public_html/wp-content/plugins/mpdf-addon-for-pdf-invoices/wt-woocommerce-packing-list-mpdf.php:301
Stack trace:
#0 /home/example/public_html/wp-includes/class-wp-hook.php(324): Wt_Pklist_Mpdf_Addon->alter_final_order_template_html('<div class="wft...', 'invoice', Object(Automattic\WooCommerce\Admin\Overrides\Order), NULL, NULL, true)
#1 /home/example/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters('<div class="wft...', Array)
#2 /home/example/public_html/wp-content/plugins/print-invoices-packing-slip-labels-for-woocommerce/admin/modules/customizer/customizer.php(1186): apply_filters('wt_pklist_alter...', '<div class="wft...', 'invoice', Object(Automattic\WooCommerce\Admin\Overrides\Order), NULL, NULL, true)
#3 /home/example/public_html/wp-content/plugins/print-invoices-packing-slip-labels-for-woocommerce/public/modules/invoice/invoice.php(1784): Wf_Woocommerce_Packing_List_Customizer->generate_template_html('<div class="wft...', 'invoice', Object(Automattic\WooCommerce\Admin\Overrides\Order))
#4 /home/example/public_html/wp-content/plugins/print-invoices-packing-slip-labels-for-woocommerce/public/modules/invoice/invoice.php(1725): Wf_Woocommerce_Packing_List_Invoice->generate_order_template_for_single_order(98068, 'Invoice_98068', '<div class="wft...', '')
#5 /home/example/public_html/wp-content/plugins/print-invoices-packing-slip-labels-for-woocommerce/public/modules/invoice/invoice.php(1503): Wf_Woocommerce_Packing_List_Invoice->generate_order_template(Array, 'Invoice_98068')
#6 /home/example/public_html/wp-includes/class-wp-hook.php(324): Wf_Woocommerce_Packing_List_Invoice->add_email_attachments(Array, Object(wf_order), 98068, 'new_order')
#7 /home/example/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#8 /home/example/public_html/wp-content/plugins/print-invoices-packing-slip-labels-for-woocommerce/admin/class-wf-woocommerce-packing-list-admin.php(270): apply_filters('wt_email_attach...', Array, Object(wf_order), 98068, 'new_order')
#9 /home/example/public_html/wp-includes/class-wp-hook.php(326): Wf_Woocommerce_Packing_List_Admin->add_email_attachments(Array, 'new_order', Object(wf_order))
#10 /home/example/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#11 /home/example/public_html/wp-content/plugins/woocommerce/includes/emails/class-wc-email.php(477): apply_filters('woocommerce_ema...', Array, 'new_order', Object(WC_Order), Object(WC_Email_New_Order))
#12 /home/example/public_html/wp-content/plugins/woocommerce/includes/emails/class-wc-email-new-order.php(112): WC_Email->get_attachments()
#13 /home/example/public_html/wp-includes/class-wp-hook.php(324): WC_Email_New_Order->trigger(98068, Object(WC_Order))
#14 /home/example/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#15 /home/example/public_html/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#16 /home/example/public_html/wp-content/plugins/woocommerce/includes/class-wc-emails.php(172): do_action_ref_array('woocommerce_ord...', Array)
#17 /home/example/public_html/wp-includes/class-wp-hook.php(324): WC_Emails::send_transactional_email(Array, Object(WC_Order))
#18 /home/example/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#19 /home/example/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#20 /home/example/public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(420): do_action('woocommerce_ord...', 98068, Object(WC_Order))
#21 /home/example/public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(253): WC_Order->status_transition()
#22 /home/example/public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php(226): WC_Order->save()
#23 /home/example/public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php(191): WC_REST_Orders_Controller->save_object(Object(WP_REST_Request), true)
#24 /home/example/public_html/wp-content/plugins/woocommerce-zapier/src/TaskHistory/Listener/APIListenerTrait.php(50): WC_REST_CRUD_Controller->create_item(Object(WP_REST_Request))
#25 /home/example/public_html/wp-includes/rest-api/class-wp-rest-server.php(1230): OM4\WooCommerceZapier\WooCommerceResource\Order\Controller->create_item(Object(WP_REST_Request))
#26 /home/example/public_html/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wc-zapier/v1/o...', Array, NULL)
#27 /home/example/public_html/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request))
#28 /home/example/public_html/wp-includes/rest-api.php(420): WP_REST_Server->serve_request('/wc-zapier/v1/o...')
#29 /home/example/public_html/wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP))
#30 /home/example/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#31 /home/example/public_html/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#32 /home/example/public_html/wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array)
#33 /home/example/public_html/wp-includes/class-wp.php(813): WP->parse_request('')
#34 /home/example/public_html/wp-includes/functions.php(1336): WP->main('')
#35 /home/example/public_html/wp-blog-header.php(16): wp()
#36 /home/example/public_html/index.php(17): require('/home/example...')
#37 {main}
thrown in /home/example/public_html/wp-content/plugins/mpdf-addon-for-pdf-invoices/wt-woocommerce-packing-list-mpdf.php on line 301

In /wp-content/plugins/mpdf-addon-for-pdf-invoices/wt-woocommerce-packing-list-mpdf.php, could lines 301 through 308 be updated to:

$children = $product_table_body_elm->children( 0 );

if( $children ) {
foreach( $children->children() as $td_elm ) {
if( $td_elm->tag == 'td' ) {
$td_elm->style = $product_table_body_style;
}
}
}

This’ll run that code only when the parent node has children and prevent the fatal error.

Thanks!

این خبر را در ایران وب سازان مرجع وب و فناوری دنبال کنید

مشاهده پاسخ های این مطلب
———————————————
این مطلب از سایت انجمن وردپرس گردآوری شده است و کلیه حقوق مطلق به انجمن وردپرس می باشد در صورت مغایرت و یا بروز مشکل اطلاع دهید تا حذف گردد

منبع: انجمن وردپرس

دکمه بازگشت به بالا