How to Find and Fix Errors in WooCommerce

This week we ran into a significant error with one of the WooCommerce stores that we run. I wanted to share how our team fixed this using Logtivity. Hopefully seeing the approach we took to resolve this issue will help in a similar situation.

We use the WooCommerce Subscriptions extension and suddenly it was no longer possible to edit any subscriptions. Every subscription screen was missing all the information, as you can see in this screenshot:

WooCommerce subscriptions error

This is the kind of problem that can be difficult to handle, because there’s rarely a good place to look for error reports.

Fortunately, we did have Logtivity installed on this site with the Error Log feature. I was able to go to the “Errors” screen and look for the most recent errors. Immediately one potential culprit was visible: Call to undefined method WC_Subscription::get_report_customer_id(). This seems a likely cause because the most recent incident was only a few moments ago.

Logtivity Error log

We use Kinsta for site hosting but their error log didn’t provide any reports of this error at all. This was something that had been caught in the site by Logtivity, but not at the server level by our hosting company.

Kinsta error log for WooCommerce

So I went back to Logtivity and checked the full details of the error report. There’s a full stack trace for this error, pointing to line #28 of the Metaboxes/CustomerHistory.php file. I was also able to share this error with our developer team thanks to the “Public Link” feature in Logtivity. The problem appears to be related to the metaboxes appearing on the Subscriptions screen, but the cause of the error isn’t immediately obvious.

WooCommerce error in Logtivity

I did a quick Google search for this error and was able to find a couple of very recent reports. That first post contains an answer from the WooCommerce support team and they pointed to this error on Github.

Google search for a WooCommerce error

That solution on the WordPress forums and Github was successful. We were able to get our WooCommerce site working again by clicking the “Advanced” tab in the “Settings” area and disabling the “Order Attribution” checkbox.

Order attribution in WooCommerce settings

WooCommerce Error Summary

It can be difficult to use your hosting company’s error logs to fix problems. Their logs focus on errors at the server level. And the logs are often difficult to search and filter.

Logtivity’s error logs record what’s going on inside WordPress. Plus they will record the errors and point you to the file that’s causing problems. We’ll notify you as soon as an error occurs, allowing you to jump on it as soon as possible rather than waiting for a user to report it.