diff --git a/includes/admin/class-wcs-admin-post-types.php b/includes/admin/class-wcs-admin-post-types.php
index 3dd26f0e8..ebc656980 100644
--- a/includes/admin/class-wcs-admin-post-types.php
+++ b/includes/admin/class-wcs-admin-post-types.php
@@ -1098,7 +1098,15 @@ public static function set_post__in_query_var( $query_vars, $post_ids ) {
public function post_updated_messages( $messages ) {
global $post, $theorder;
- $created_date = ! empty( $theorder ) && $theorder instanceof WC_Subscription ? $theorder->get_date_created() : $post->post_date;
+ if ( ! isset( $theorder ) || ! $theorder instanceof WC_Subscription ) {
+ if ( ! isset( $post ) || 'shop_subscription' !== $post->post_type ) {
+ return $messages;
+ } elseif ( class_exists( 'Automattic\WooCommerce\Utilities\OrderUtil' ) ) {
+ \Automattic\WooCommerce\Utilities\OrderUtil::init_theorder_object( $post );
+ } else {
+ return $messages;
+ }
+ }
$messages['shop_subscription'] = array(
0 => '', // Unused. Messages start at index 1.
@@ -1112,7 +1120,7 @@ public function post_updated_messages( $messages ) {
7 => __( 'Subscription saved.', 'woocommerce-subscriptions' ),
8 => __( 'Subscription submitted.', 'woocommerce-subscriptions' ),
// translators: php date string
- 9 => sprintf( __( 'Subscription scheduled for: %1$s.', 'woocommerce-subscriptions' ), '' . date_i18n( _x( 'M j, Y @ G:i', 'used in "Subscription scheduled for "', 'woocommerce-subscriptions' ), wcs_date_to_time( $created_date ) ) . '' ),
+ 9 => sprintf( __( 'Subscription scheduled for: %1$s.', 'woocommerce-subscriptions' ), '' . date_i18n( _x( 'M j, Y @ G:i', 'used in "Subscription scheduled for "', 'woocommerce-subscriptions' ), wcs_date_to_time( $theorder->get_date_created() ?? $post->post_date ) ) . '' ),
10 => __( 'Subscription draft updated.', 'woocommerce-subscriptions' ),
);