woocommerce / woocommerce-gateway-paypal-express-checkout

58 stars 65 forks source link

Uncaught Error: Call to a member function get_sku() on bool in /wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-client.php:842 #841

Closed Jany-M closed 3 years ago

Jany-M commented 3 years ago

SKU is not present, PayPal is generating a fatal error onsite, making purchases/payments impossible. Not all stores have SKUs and it should not be required. Use ID or fallback if is SKU not present, please.

2020-12-15T10:49:17+00:00 CRITICAL Uncaught Error: Call to a member function get_sku() on bool in /wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-client.php:842
Stack trace:
#0 /wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-client.php(703): WC_Gateway_PPEC_Client->_get_paypal_line_items_from_order(Object(Automattic\WooCommerce\Admin\Overrides\Order))
#1 /wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-client.php(937): WC_Gateway_PPEC_Client->_get_details_from_order(6712)
#2 /wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-checkout-handler.php(916): WC_Gateway_PPEC_Client->get_do_express_checkout_params(Array)
#3 /wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/abstracts/abstract-wc-gateway in /wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-client.php at line 842
LCmry commented 3 years ago

Thanks for the report @Jany-M , which version of WooCommerce is being used on the site?

Jany-M commented 3 years ago
WP Version: 5.6
WC Version: 4.8.0
WooCommerce PayPal Checkout Gateway: by WooCommerce – 2.1.1

Also added add_filter( 'wc_product_sku_enabled', '__return_false' ); to no effect, same issue.

jorgeatorres commented 3 years ago

Hi @Jany-M! This looks like a duplicate of #826. What the error log you've shared tells us is that one of the products in the order you're about to pay no longer exists. SKUs shouldn't have anything to do with it, despite get_sku() appearing in the logs.

I'll be looking into #826 soon and so I'm closing this issue in favor of that one. Feel free to re-open if you believe this is different from #826 in any way.

Thanks again for the report!