diff --git a/changelog.txt b/changelog.txt index 60b625800..47099b142 100644 --- a/changelog.txt +++ b/changelog.txt @@ -11,6 +11,7 @@ * Fix - Ensure the scheduled sale price for subscription products ends at the end of the "to" day set in product settings. * Fix - Subscription table is empty in mobile view when HPOS is enabled. * Fix - WooCommerce page header is hidden when HPOS is enabled. +* Fix - Subscription updated messages missing on the Edit Subscription page when HPOS is enabled. * Fix - Resolved an issue that prevented bulk actions from running on the Subscriptions list table when the table was filtered by date, payment method, product or customer. * Dev - Calling wcs_create_subscription() will no longer attempt to fetch a fresh instance of the subscription at the end. This is to prevent loading the subscription from the database potentially unnecessarily. diff --git a/includes/admin/class-wcs-admin-post-types.php b/includes/admin/class-wcs-admin-post-types.php index 0a30b2964..3dd26f0e8 100644 --- a/includes/admin/class-wcs-admin-post-types.php +++ b/includes/admin/class-wcs-admin-post-types.php @@ -67,6 +67,7 @@ public function __construct() { add_action( 'parse_query', array( $this, 'shop_subscription_search_custom_fields' ) ); add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); + add_filter( 'woocommerce_order_updated_messages', array( $this, 'post_updated_messages' ) ); // Add ListTable filters when CPT is enabled add_action( 'restrict_manage_posts', array( $this, 'restrict_by_product' ) ); @@ -1095,7 +1096,9 @@ public static function set_post__in_query_var( $query_vars, $post_ids ) { * @return array */ public function post_updated_messages( $messages ) { - global $post, $post_ID; + global $post, $theorder; + + $created_date = ! empty( $theorder ) && $theorder instanceof WC_Subscription ? $theorder->get_date_created() : $post->post_date; $messages['shop_subscription'] = array( 0 => '', // Unused. Messages start at index 1. @@ -1109,7 +1112,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( $post->post_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( $created_date ) ) . '' ), 10 => __( 'Subscription draft updated.', 'woocommerce-subscriptions' ), );