“Fatal Error” when trying to delete products or add a new one
-
I am seeing an error when trying to delete products or add a new one, video here but the Product Gallery says Fatal Error.
https://vimeo.com/522058148/87b918a4f0
Does anyone have any ideas? I have already tried deleting and redownloading it, but the errors (and products) remain.
-
Hey @bplatt21,
Thanks for sharing that video of the problem. Can you go to the WooCommerce > Status > Logs page of the site and look through the dropdown list for recent logs that begin with ‘fatal-error’ there? If you do see a fatal error log, look for the date that this occurred on the site, select the corresponding log (for that date), and then click the “View” button.
If the cause of that error isn’t clear, feel free to copy/paste that log into a reply here. Thanks!
Wow thanks @shaunkuschel! Yes, there are a lot of Fatal Errors, 4 in fact, but this is the most recent one-
2021-03-10T20:47:18+00:00 CRITICAL Uncaught Error: Call to a member function get_gallery_image_ids() on bool in /home/customer/www/thesharkcafe.com/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-images.php:37 Stack trace: #0 /home/customer/www/thesharkcafe.com/public_html/wp-admin/includes/template.php(1389): WC_Meta_Box_Product_Images::output(Object(WP_Post), Array) #1 /home/customer/www/thesharkcafe.com/public_html/wp-admin/edit-form-advanced.php(681): do_meta_boxes(Object(WP_Screen), 'side', Object(WP_Post)) #2 /home/customer/www/thesharkcafe.com/public_html/wp-admin/post-new.php(75): require('/home/customer/...') #3 {main} thrown in /home/customer/www/thesharkcafe.com/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-images.php on line 37 2021-03-10T20:54:00+00:00 CRITICAL Uncaught Error: Call to a member function get_gallery_image_ids() on bool in /home/customer/www/thesharkcafe.com/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-images.php:37 Stack trace: #0 /home/customer/www/thesharkcafe.com/public_html/wp-admin/includes/template.php(1389): WC_Meta_Box_Product_Images::output(Object(WP_Post), Array) #1 /home/customer/www/thesharkcafe.com/public_html/wp-admin/edit-form-advanced.php(681): do_meta_boxes(Object(WP_Screen), 'side', Object(WP_Post)) #2 /home/customer/www/thesharkcafe.com/public_html/wp-admin/post-new.php(75): require('/home/customer/...') #3 {main} thrown in /home/customer/www/thesharkcafe.com/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-images.php on line 37 2021-03-10T21:04:55+00:00 CRITICAL Uncaught Error: Call to a member function get_gallery_image_ids() on bool in /home/customer/www/thesharkcafe.com/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-images.php:37 Stack trace: #0 /home/customer/www/thesharkcafe.com/public_html/wp-admin/includes/template.php(1389): WC_Meta_Box_Product_Images::output(Object(WP_Post), Array) #1 /home/customer/www/thesharkcafe.com/public_html/wp-admin/edit-form-advanced.php(681): do_meta_boxes(Object(WP_Screen), 'side', Object(WP_Post)) #2 /home/customer/www/thesharkcafe.com/public_html/wp-admin/post-new.php(75): require('/home/customer/...') #3 {main} thrown in /home/customer/www/thesharkcafe.com/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-images.php on line 37 2021-03-10T21:05:38+00:00 CRITICAL Uncaught Error: Call to a member function get_gallery_image_ids() on bool in /home/customer/www/thesharkcafe.com/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-images.php:37 Stack trace: #0 /home/customer/www/thesharkcafe.com/public_html/wp-admin/includes/template.php(1389): WC_Meta_Box_Product_Images::output(Object(WP_Post), Array) #1 /home/customer/www/thesharkcafe.com/public_html/wp-admin/edit-form-advanced.php(681): do_meta_boxes(Object(WP_Screen), 'side', Object(WP_Post)) #2 /home/customer/www/thesharkcafe.com/public_html/wp-admin/post-new.php(75): require('/home/customer/...') #3 {main} thrown in /home/customer/www/thesharkcafe.com/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-images.php on line 37
Hey @bplatt21,
Thanks for sharing those logs! Each of those fatal errors are related to the same thing- which is the line of code in core WooCommerce that is related to the gallery image IDs on the edit product page of the admin dashboard (which was shown in the video). Specifically, this is the code referenced:
$product_image_gallery = $product_object->get_gallery_image_ids( 'edit' );
This can be caused by a few different things- including whether there are actually any images in the gallery or not, if the image IDs are not accessible or there was an issue when the gallery images were uploaded, or a code conflict (like in cases where another plugin is also referencing or overriding that base code to add or modify the images or gallery).
I would suggest taking a look at those things first and try removing any gallery images and re-uploading them.
Let me know if this helps or if you run into any other issues. Cheers!
Got it, @shaunkuschel, thanks so much! So the site has very few plugins (list below), but this really became an issue when I tried to use a plugin (that I since deleted) to upload products.
The wrinkle is I can’t delete images-or products—at all. Oh boy! Here is a quick screengrab of what I am seeing when I try to delete anything: https://vimeo.com/525230698/7802b75433
Is there a way that we can start from a blank install?
Plugins
Autoptimize
Beaver Builder Plugin (Pro Version)
Beaver Themer
Coming Soon Page, Maintenance Mode & Landing Pages by SeedProd
Gravity Forms
Mailchimp for WooCommerce
SG Optimizer
WooCommerce
WordPress Starter
WP Super CacheHey @bplatt21,
Thanks for sharing the video!
With so few plugins active on the site, it could possibly be related to the active theme/any template overrides it includes, which you can check by temporarily switching to an up-to-date version of a default WordPress theme like Twenty Twenty to see if that helps or not. Otherwise, it looks like it could be related to the site’s database (DB), which can be modified by some plugins and the changes made will remain even after that plugin is deleted.
If starting with a fresh install is an option, you can definitely try that approach. Like many plugins, WooCommerce doesn’t delete the data saved in the DB when the plugin is deactivated/deleted. Instead, it just removes the plugin files themselves, to help with situations where those plugin files may need to be replaced but all of the orders, products, settings, etc, should remain (and populate the new installation of the plugin).
Our Installing and Uninstalling doc explains this a bit more but it also includes a code snippet in the “Uninstalling WooCommerce” section that you can add to the
wp-config.php
file of your site before deactivating and deleting the WooCommerce plugin that will remove all of the WooCommerce-created data. Once that is done, you can download and re-install WooCommerce and start with a ‘fresh’ install. ??If you do decide that you want to keep some WC data (rather than deleting it all as described above), you can try using a plugin that allows for bulk editing of specific types of data (like products)- such as this free plugin available here on www.ads-software.com.
Hope this helps, let me know how it goes! Cheers!
Thanks so much, @shaunkuschel, this has been very helpful!
So I added the code and uninstalled WC. That part worked, and it started all over and asked me to create a new store, so far, so good.
However, I am still not able to add new images (they are perpetually in the Crunching phase- image), and I can’t delete either: image. I also changed the theme like you recommended to see if that would allow me to upload images and delete, and that didn’t work either.
So, it might be safe to say that this isn’t directly related to WooCommerce, since I effectively deleted it and reinstalled it, correct? I was also thinking that at one point I had a few more plugins, including a few for bulk uploading products, but I deleted them as well. Could that be part of the issue here? Could some of these plugins have changed my permissions/the DB enough to make it so that I can’t delete/reupload (even as the super admin), and I didn’t delete all their settings effectively when I just uninstalled the plugin? I am working with an org that thinks I have to start the site all over, but I just cant’ stop feeling that there is a way to fix this.
- This reply was modified 3 years, 8 months ago by bplatt21.
Hey @shaunkuschel, just wanted to see if you had any intel on this, if not, I might have to opt to start all over, but first wanted to double-check that there wasn’t another route to check before I recreate the site entirely.
Hey @bplatt21,
Sorry for the delay getting back to you, but happy to try and provide some more suggestions.
As you mentioned, it doesn’t seem like this problem is specifically related to WooCommerce, but I’d suggest taking a look at this core WordPress doc, as it has a little more info about database permissions and changes (like those made by plugins that could have been since removed).
Also, if the site is hosted by a hosting company (rather than on your own server, that is), I’d suggest contacting the hosting company to see if they can see anything regarding the database that seems like it could be causing the issue and ask if they have any suggestions on how to fix it too.
Hey @bplatt21! I hope that info above was helpful. I’m going to close this thread but if you have any other questions or would like additional suggestions, feel free to create a new post and just link to this one for context (if needed). Thanks!
- The topic ‘“Fatal Error” when trying to delete products or add a new one’ is closed to new replies.