Automattic / woocommerce-services

WooCommerce Services is a feature plugin that integrates hosted services into WooCommerce (3.0+), and currently includes automated tax rates and the ability to purchase and print USPS shipping labels.
GNU General Public License v2.0
107 stars 20 forks source link

2.2.4 Corrupted 2 Orders #2650

Open Stella3 opened 1 year ago

Stella3 commented 1 year ago

Not a lot of time to explain this but I had 2 large orders that were very screwed up by 2.2.4.

Both had items at 0 qty on the order and both had items that were duplicated on the orders so the customer was charged double.

Neither order pulls up in Woo --> Orders. It just brings up a blank screen with a critical error warning.

I get this:

When seeking help with this issue, you may be asked for some of the following information: WordPress version 6.2 Active theme: Pro (version 6.2.2) Current plugin: WooCommerce Shipping & Tax (version 2.2.4) PHP version 8.1.18

Error Details

An error of type E_ERROR was caused in line 55 of the file /www/wp-content/plugins/woocommerce-services/classes/class-wc-connect-utils.php. Error message: Uncaught DivisionByZeroError: Division by zero in /www/wp-content/plugins/woocommerce-services/classes/class-wc-connect-utils.php:55 Stack trace:

0 /www/wp-content/plugins/woocommerce-services/classes/class-wc-connect-shipping-label.php(204): WC_Connect_Utils::get_product_price_from_order(4226809, Object(Automattic\WooCommerce\Admin\Overrides\Order))

1 /www/wp-content/plugins/woocommerce-services/classes/class-wc-connect-shipping-label.php(292): WC_Connect_Shipping_Label->get_selected_packages(Object(Automattic\WooCommerce\Admin\Overrides\Order))

2 /www/wp-content/plugins/woocommerce-services/classes/class-wc-connect-shipping-label.php(521): WC_Connect_Shipping_Label->get_form_data(Object(Automattic\WooCommerce\Admin\Overrides\Order))

3 /www/wp-content/plugins/woocommerce-services/classes/class-wc-connect-shipping-label.php(566): WC_Connect_Shipping_Label->get_label_payload(4254439)

4 /wordpress/wp-admin/includes/template.php(1445): WC_Connect_Shipping_Label->meta_box(Object(WP_Post), Array)

5 /wordpress/wp-admin/edit-form-advanced.php(681): do_meta_boxes(Object(WP_Screen), 'side', Object(WP_Post))

6 /wordpress/wp-admin/post.php(206): require('/wordpress/wp-a...')

7 {main}

thrown

I rolled back to 2.2.3 and the orders now pull up fine.

The qtys and $ amounts are still very wrong on both orders.

Again, sorry for the informal report but I have no time to go through the whole process.

harriswong commented 1 year ago

Thanks for the report @Stella3, what's your WooCommerce version please?

Dev notes

2.2.4 has this change https://github.com/Automattic/woocommerce-services/commit/a2a1b25b8a26789bbb3979d6892262d0c78102c4. Why would this change result in a Division by zero error?