Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
80 stars 29 forks source link

Fixes attempt to read property "post_date" on null errors #617

Closed mattallan closed 1 month ago

mattallan commented 1 month ago

Description

I recently merged https://github.com/Automattic/woocommerce-subscriptions-core/pull/615 which fixed an issue with "Subscription updated." messages missing on stores with HPOS enabled.

While smoke testing the release I noticed the following notices:

PHP Warning:  Attempt to read property "post_date" on null in /Users/matt/local/woo/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php on line 1101

This PR fixes these issues.

How to test this PR

  1. I found the issue while manually running the "process renewal" from the Edit subscription page

Product impact

mattallan commented 1 month ago

I've tested this PR on stores with HPOS enabled and disabled. Confirmed the PHP warning isn't showing anymore and confirmed the "Subscription updated." messaging is displayed properly.