Commit 28aec671ee for woocommerce
commit 28aec671ee1e138690b1ef10134cfb4afbf53d20
Author: Jorge A. Torres <jorge.torres@automattic.com>
Date: Fri Jan 23 15:14:08 2026 +0000
Drop A-S dependency for refunds note creation (#62929)
diff --git a/plugins/woocommerce/changelog/fix-possible-notice-after-62033 b/plugins/woocommerce/changelog/fix-possible-notice-after-62033
new file mode 100644
index 0000000000..097212a962
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-possible-notice-after-62033
@@ -0,0 +1,5 @@
+Significance: patch
+Type: update
+Comment: Minor update in unreleased change
+
+
diff --git a/plugins/woocommerce/includes/admin/notes/class-wc-notes-refund-returns.php b/plugins/woocommerce/includes/admin/notes/class-wc-notes-refund-returns.php
index 279257893e..f65c983224 100644
--- a/plugins/woocommerce/includes/admin/notes/class-wc-notes-refund-returns.php
+++ b/plugins/woocommerce/includes/admin/notes/class-wc-notes-refund-returns.php
@@ -24,10 +24,23 @@ class WC_Notes_Refund_Returns {
* Attach hooks.
*/
public static function init() {
- add_action( 'wc_notes_refund_returns_page_created', array( __CLASS__, 'possibly_add_note' ) );
+ add_action( 'woocommerce_newly_installed', array( __CLASS__, 'on_newly_installed' ) );
add_filter( 'woocommerce_get_note_from_db', array( __CLASS__, 'get_note_from_db' ), 10, 1 );
}
+ /**
+ * Add the note when WooCommerce is newly installed.
+ *
+ * @since 10.5.0
+ * @return void
+ */
+ public static function on_newly_installed() {
+ $page_id = get_option( 'woocommerce_refund_returns_page_id' );
+ if ( $page_id ) {
+ self::possibly_add_note( $page_id );
+ }
+ }
+
/**
* Maybe add a note to the inbox.
*
diff --git a/plugins/woocommerce/includes/class-wc-install.php b/plugins/woocommerce/includes/class-wc-install.php
index 21dfd0df08..411e92a8b6 100644
--- a/plugins/woocommerce/includes/class-wc-install.php
+++ b/plugins/woocommerce/includes/class-wc-install.php
@@ -2990,11 +2990,17 @@ EOT;
* @return void
*/
public static function page_created( $page_id, $page_data ) {
- if ( 'refund_returns' === $page_data['post_name'] ) {
- if ( Constants::is_true( 'WC_INSTALLING' ) ) {
- as_schedule_single_action( time() + MINUTE_IN_SECONDS, 'wc_notes_refund_returns_page_created', array( $page_id ), 'woocommerce', true );
+ if ( Constants::is_true( 'WC_INSTALLING' ) ) {
+ return;
+ }
+
+ if ( 'refund_returns' === $page_data['post_name'] && class_exists( 'WC_Notes_Refund_Returns', false ) ) {
+ $callback = fn() => WC_Notes_Refund_Returns::possibly_add_note( $page_id );
+
+ if ( did_action( 'init' ) ) {
+ $callback();
} else {
- WC_Notes_Refund_Returns::possibly_add_note( $page_id );
+ add_action( 'init', $callback );
}
}
}