Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Daniel

WooCommerce add-on: Fatal error if order contains a removed product

Hey,

I got this error message:

Fatal error: Uncaught Error: Call to a member function get_weight() on bool in /path/to/wp-content/plugins/ac-addon-woocommerce/classes/Column/ShopOrder/TotalWeight.php:37

when listing an order that contained a removed product (permanently removed, not in trash).

I did a quick fix in your function get_raw_value to avoid the fatal error:

Before:

$weight = (int) $item->get_quantity() * (float) $item->get_product()->get_weight();
$total_weight += $weight;

After:

if ( $item['product_id'] > 0 ) {
    $weight = (int) $item->get_quantity() * (float) $item->get_product()->get_weight();
    $total_weight += $weight;
}

I hope that you’ll fix this issue in the next version.

Many thanks!

4 years ago
Stefan van den Dungen Gronovius
Developer

Thanks for your feedback and input on this.
It should indeed check for a product before we call the weight method.
It will definitely be fixed in the next release of the WooCommerce integration.

4 years ago

You must be logged in to reply to this topic.