Commit 6e57aacc46b for woocommerce
commit 6e57aacc46b2428042e3bd681043ace09518e071
Author: Yuliyan Slavchev <yuliyan.slavchev@gmail.com>
Date: Tue Mar 10 11:38:31 2026 +0200
Fix Store Email personalization tag always returning the admin email (#63605)
* Fix Store Email personalization tag always returning the admin email
* Add changelog
* Fix phpstan error
diff --git a/plugins/woocommerce/changelog/wooplug-6390-email-editor-email-template-order-fulfilled-block b/plugins/woocommerce/changelog/wooplug-6390-email-editor-email-template-order-fulfilled-block
new file mode 100644
index 00000000000..db5dc5c8534
--- /dev/null
+++ b/plugins/woocommerce/changelog/wooplug-6390-email-editor-email-template-order-fulfilled-block
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix a bug with the Store Email personalization tag that caused it to always return the admin email instead of using the `get_from_address` method from the email object context
diff --git a/plugins/woocommerce/phpstan-baseline.neon b/plugins/woocommerce/phpstan-baseline.neon
index d1bb250ae20..2883f1ea213 100644
--- a/plugins/woocommerce/phpstan-baseline.neon
+++ b/plugins/woocommerce/phpstan-baseline.neon
@@ -65148,12 +65148,6 @@ parameters:
count: 1
path: src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php
- -
- message: '#^Call to an undefined method object\:\:get_from_address\(\)\.$#'
- identifier: method.notFound
- count: 1
- path: src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\EmailEditor\\WCTransactionalEmails\\WCTransactionalEmailPostsGenerator\:\:generate_email_templates\(\) has no return type specified\.$#'
identifier: missingType.return
diff --git a/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php b/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php
index 21b978c5af3..3f29fae90a0 100644
--- a/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php
+++ b/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php
@@ -27,8 +27,9 @@ class StoreTagsProvider extends AbstractTagProvider {
'woocommerce/store-email',
__( 'Store', 'woocommerce' ),
function ( array $context ): string {
- if ( isset( $context['wc_email'], $context['wc_email']->get_from_address ) ) {
- return $context['wc_email']->get_from_address();
+ $wc_email = $context['wc_email'] ?? null;
+ if ( $wc_email instanceof \WC_Email ) {
+ return $wc_email->get_from_address();
}
return get_option( 'admin_email' );
},