v4.7.0 Order Type Error
-
The recent update, v4.7.0, causes a type error when viewing a specific order in admin, viewing a page of the admin orders table which contains a specific order, or when viewing the checkout page. I’m not certain what is causing the issue with specific orders exactly.
The current temporary solution is to rollback to v4.6.1 which does not throw this error.
My recommendation is to allow bool and/or null types for the
$orderproperty ofmaybe_display_gift_data_below_admin_shipping_fieldsand sanitize it throughwc_get_order. Something to the effect of:$order = wc_get_order($order);
if (!$order) return;Here are the full details of the error:
Error Details
=============
An error of type E_ERROR was caused in line 617 of the file /home/.../public_html/wp-content/plugins/woocommerce-shipstation-integration/includes/class-checkout.php. Error message: Uncaught TypeError: WooCommerce\Shipping\ShipStation\Checkout::maybe_display_gift_data_below_admin_shipping_fields(): Argument #2 ($order) must be of type WC_Order, false given, called in /home/.../public_html/wp-includes/class-wp-hook.php on line 324 and defined in /home/.../public_html/wp-content/plugins/woocommerce-shipstation-integration/includes/class-checkout.php:617
Stack trace:
#0 /home/.../public_html/wp-includes/class-wp-hook.php(324): WooCommerce\Shipping\ShipStation\Checkout->maybe_display_gift_data_below_admin_shipping_fields(Array, false, 'edit')
#1 /home/.../public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#2 /home/.../public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php(126): apply_filters('woocommerce_adm...', Array, false, 'edit')
#3 /home/.../public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php(183): WC_Meta_Box_Order_Data::get_shipping_fields()
#4 /home/.../public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/class-wcs-meta-box-subscription-data.php(37): WC_Meta_Box_Order_Data::init_address_fields()
#5 /home/.../public_html/wp-admin/includes/template.php(1456): WCS_Meta_Box_Subscription_Data::output(Object(WC_Subscription), Array)
#6 /home/.../public_html/wp-admin/edit-form-advanced.php(721): do_meta_boxes(Object(WP_Screen), 'normal', Object(WP_Post))
#7 /home/.../public_html/wp-admin/post.php(206): require('/home/...')
#8 {main}
thrown
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘v4.7.0 Order Type Error’ is closed to new replies.