woothemes/woocommerce — pull request #4902 by thenbrent (2014-02-22 01:41:13+00:00)
Title: Check product exists before accessing methods when sending order email

In a similar vein to #4681, in WC 2.1, when a store manager has deleted a product or variation, the `email-order-items.php` template will throw a fatal error.

This happens when sending renewal order emails in Subscriptions, but could also affect order emails sent by other extensions and even those sent by WC core (though it's very unlikely).

Check out ZD ticket 147998 for a customer who's had a hell of a time because of this (and PayPal retrying IPN requests ~18 times because the fatal error was causing IPN requests to fail).

On a related note, in the hope of preventing these type of issues, I'm going to add code to Subscriptions to:

1. prevent permanently deleting subscription products
2. remove the permanently delete UI elements for subscription and variable subscription products
3. hide the "Remove" button on subscription variations.

I think that preventative measure is much better than refactoring all the code base in WC and other extensions which may require a product to exist.