Commit 4fc47b3a6e3 for woocommerce
commit 4fc47b3a6e3a47f7365b6bf1aa77a34514f7abc2
Author: Néstor Soriano <konamiman@konamiman.com>
Date: Wed Sep 30 10:01:39 2026 +0200
Add an admin notice about the upcoming change in PHP requirements (PHP 8.1) (#69094)
diff --git a/plugins/woocommerce/changelog/add-php-81-bump-notice b/plugins/woocommerce/changelog/add-php-81-bump-notice
new file mode 100644
index 00000000000..c058fba0a96
--- /dev/null
+++ b/plugins/woocommerce/changelog/add-php-81-bump-notice
@@ -0,0 +1,4 @@
+Significance: patch
+Type: add
+
+Add an admin notice about the upcoming PHP 8.1 requirement in WooCommerce 11.6 for stores running an older PHP version.
diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-notices.php b/plugins/woocommerce/includes/admin/class-wc-admin-notices.php
index a0dfec38561..4d767b445f6 100644
--- a/plugins/woocommerce/includes/admin/class-wc-admin-notices.php
+++ b/plugins/woocommerce/includes/admin/class-wc-admin-notices.php
@@ -64,6 +64,10 @@ class WC_Admin_Notices {
if ( defined( 'WC_PHP_MIN_REQUIREMENTS_NOTICE' ) ) {
self::remove_notice( WC_PHP_MIN_REQUIREMENTS_NOTICE );
}
+ // Notice about the PHP 8.1 requirement in WooCommerce 11.6, remove in that version (see also reset_admin_notices).
+ if ( ! function_exists( 'phpversion' ) || version_compare( phpversion(), '8.1', '>=' ) ) {
+ self::remove_notice( 'php81_required_in_woo_116' );
+ }
add_action( 'switch_theme', array( __CLASS__, 'reset_admin_notices' ) );
add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) );
@@ -166,6 +170,26 @@ class WC_Admin_Notices {
* @return void
*/
public static function reset_admin_notices() {
+ // Notice about the PHP 8.1 requirement in WooCommerce 11.6, remove in that version (see also init).
+ if ( function_exists( 'phpversion' ) && version_compare( phpversion(), '8.1', '<' ) ) {
+ self::add_custom_notice(
+ 'php81_required_in_woo_116',
+ sprintf(
+ '<h4>%s</h4>%s',
+ esc_html__( 'PHP version requirements will change soon', 'woocommerce' ),
+ wpautop(
+ wp_kses_data(
+ sprintf(
+ /* translators: 1: The PHP version the server is currently running. 2: URL of the announcement post. */
+ __( 'WooCommerce 11.6, planned for release in <b>February 2027</b>, will require PHP 8.1 or newer to work. Your server is currently running PHP %1$s, so this change will impact your store. Please contact your hosting provider to upgrade to PHP 8.1 or newer (at least PHP 8.3 is recommended). <b><a href="%2$s">Learn more about this change.</a></b>', 'woocommerce' ),
+ phpversion(),
+ esc_url( 'https://developer.woocommerce.com/2026/09/29/php-8-1-requirement/' )
+ )
+ )
+ )
+ )
+ );
+ }
}
/**