woocommerce / woocommerce-gateway-paypal-express-checkout

58 stars 65 forks source link

Fatal error when product is no longer in catalog #826

Closed Spreeuw closed 3 years ago

Spreeuw commented 3 years ago

Describe the bug

When a product is removed from the catalog, but an order with this product is still pending payment and attempted to be paid for by PayPal express, the gateway crashes.

To reproduce

  1. Create a temporary product
  2. Create a manual order with this product
  3. Remove the product from WooCommerce
  4. Try to pay for the order with PP Express

Error:

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

Expected behavior

Product existence should be checked before attempting to call product methods, order should be able to be paid for.

Environment (please complete the following information):

Jany-M commented 3 years ago

@jorgeatorres About the other issue I opened. The product is created in runtime, so it's not present at all times, but it is created virtually to be able to add it to a Woo order. This works fine when the SKU check is disabled (Woo is used by several themes and plugins just for its checkout, not for its products management).

jorgeatorres commented 3 years ago

@Jany-M: Thanks for the additional details. I'll be sure to include that scenario in my testing.

jessLundie commented 3 years ago

Also seen in 3665663-zen, breaking subscription renewals for products that no longer exist. @jorgeatorres, I set the priority of this to High given its potential impact on Subscriptions sites.

Is there any kind of workaround or snippet we can give this customer in the meantime to disable this so their subscription renewals can process successfully?

Spreeuw commented 3 years ago

@jorgeatorres this is a serious issue that is super easy to fix, what's holdup?