Facebook-for-woocommerce: PHP Fatal error: Uncaught Error: Call to a member function get_name() on string in plugins/facebook-for-woocommerce/includes/Products.php:1115

Created on 29 Oct 2020  Β·  4Comments  Β·  Source: facebookincubator/facebook-for-woocommerce

πŸ”Ž Isolate the bug

  • [X] I have confirmed this occurs in the most recent version of WordPress, WooCommerce, and Facebook for WooCommerce.
  • [X] I have confirmed this occurs when only WooCommerce and Facebook for WooCommerce are active and when using a default WordPress or WooCommerce theme.

✍️ Describe the bug

Uncaught Error: Call to a member function get_name() on string in /plugins/facebook-for-woocommerce/includes/Products.php:1115

When lines 1112-1120 are commented out in Products.php sync runs fine.

It looks like strtolower( $attribute->get_name() ) === $key ) the attribute object is not being passed correctly.

πŸšΆβ€β™€οΈ Steps to reproduce

  1. Try to Synchronise products
  2. Failure to Synchronise Products

βœ”οΈ Expected behavior

Product sync should update all products

πŸ—ƒ Logs

PHP Fatal error: Uncaught Error: Call to a member function get_name() on string in /var/www/webapp/web/app/plugins/facebook-for-woocommerce/includes/Products.php:1115\nStack trace:\n#0 /var/www/webapp/web/app/plugins/facebook-for-woocommerce/includes/fbproduct.php(674): SkyVerge\WooCommerce\Facebook\Products::get_enhanced_catalog_attribute('color', Object(WC_Product_Variation))\n#1 /var/www/webapp/web/app/plugins/facebook-for-woocommerce/includes/fbproduct.php(605): WC_Facebook_Product->apply_enhanced_catalog_fields_from_attributes(Array, '672')\n#2 /var/www/webapp/web/app/plugins/facebook-for-woocommerce/includes/fbproductfeed.php(646): WC_Facebook_Product->prepare_product('TTPO01_950', 'feed')\n#3 /var/www/webapp/web/app/plugins/facebook-for-woocommerce/includes/fbproductfeed.php(580): WC_Facebook_Product_Feed->prepare_product_for_feed(Object(WC_Facebook_Product), Array)\n#4 /var/www/webapp/web/app/plugins/facebook-for-woocommerce/includes/fbproductfeed.php(489): WC_Facebook_Product_Feed->write_product_feed_file(Array)\n#5 /var/ww in /var/www/webapp/web/app/plugins/facebook-for-woocommerce/includes/Products.php on line 1115, referer: https://thesette.com/wp/wp-admin/admin-ajax.php?action=as_async_request_queue_runner&nonce=6a985240f8

Most helpful comment

Fixed with release 2.1.4:
_2020.11.04 - version 2.1.4_
_* Fix - Ensure product variant attributes are correctly handled when checking for enhanced attribute values._

All 4 comments

I'm seeing a similar error when running cron from the console:

wp cron event run --due-now
Fatal error: Uncaught Error: Call to a member function get_name() on string in /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/Products.php:1115
Stack trace:
#0 /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/fbproduct.php(674): SkyVerge\WooCommerce\Facebook\Products::get_enhanced_catalog_attribute('gender', Object(WC_Product_Variation))
#1 /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/fbproduct.php(605): WC_Facebook_Product->apply_enhanced_catalog_fields_from_attributes(Array, '4943')#2 /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/fbproductfeed.php(646): WC_Facebook_Product->prepare_product('5060444300277_9...', 'feed')
#3 /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/fbproductfeed.php(580): WC_Facebook_Product_Feed->prepare_product_for_feed(Object(WC_Facebook_Product), Array)
 in /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/Products.php on line 1115

I'm seeing a similar error when running cron from the console:

wp cron event run --due-now
Fatal error: Uncaught Error: Call to a member function get_name() on string in /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/Products.php:1115
Stack trace:
#0 /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/fbproduct.php(674): SkyVerge\WooCommerce\Facebook\Products::get_enhanced_catalog_attribute('gender', Object(WC_Product_Variation))
#1 /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/fbproduct.php(605): WC_Facebook_Product->apply_enhanced_catalog_fields_from_attributes(Array, '4943')#2 /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/fbproductfeed.php(646): WC_Facebook_Product->prepare_product('5060444300277_9...', 'feed')
#3 /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/fbproductfeed.php(580): WC_Facebook_Product_Feed->prepare_product_for_feed(Object(WC_Facebook_Product), Array)
 in /home/example.com/public_html/wp-content/plugins/facebook-for-woocommerce/includes/Products.php on line 1115

Issue is solved by this commit https://github.com/facebookincubator/facebook-for-woocommerce/pull/1676/commits/e661a0fd779c5bf7238a81159b51d70ca78330aa

This has been also reported by at least one user in WooCommerce. Hopefully, it can get fixed soon.

Fixed with release 2.1.4:
_2020.11.04 - version 2.1.4_
_* Fix - Ensure product variant attributes are correctly handled when checking for enhanced attribute values._

Was this page helpful?
0 / 5 - 0 ratings