• I’ve got the following message on the Woocommerce – Reports – Stock page:
    “There has been a critical error on your website. Please check your site admin email inbox for instructions.”
    It appears to be caused by the woo-donations plugin – if I deactivate this plugin the error goes away. I’ve tried all other plugins, but the culprit is donations. Any ideas? (Everything else appears to be working ok. Love the plugin!)
    Thanks,
    Ian

Viewing 1 replies (of 1 total)
  • I have spotted the same thing. It’s because the plugin is changing the global $product variable from a Product object into a string, the ID of the product.

    It’s causing this fatal error:
    PHP Fatal error: Uncaught Error: Call to a member function get_id() on string in /wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-stock.php:81

    which is this:

    if ( ! $product || $product->get_id() !== $item->id ) {
    	$product = wc_get_product( $item->id );
    }

    changing to this worked

    if ( ! $product || is_string($product) || $product->get_id() !== $item->id ) {
    	$product = wc_get_product( $item->id );
    }
    • This reply was modified 4 years, 3 months ago by admzttt.
Viewing 1 replies (of 1 total)
  • The topic ‘Plugin causes “critical error” in product report’ is closed to new replies.