Commit a8ba994112a for woocommerce

commit a8ba994112a5ca1debbb8bbfd517810f073e17d9
Author: Adam Grzybkowski <agrzybkowski@outlook.com>
Date:   Mon Jun 1 08:19:37 2026 +0200

    Drop icon and add emoji to store_stock/store_order notifications (#65391)

    * Drop icon field from store_order push notification

    WordPress.com now treats the notification icon as optional, so stop
    sending the hard-coded icon for the store_order payload.

    * Drop icon field from store_stock push notification

    WordPress.com now treats the notification icon as optional, so stop
    sending the hard-coded icon for the store_stock payload.

    * Append event-specific emoji to store_stock notification title

    Add a per-event emoji to the end of the stock notification titles —
    ⚠️ for low stock, 🚨 for out of stock, and 🕐 for backorder — passed as a
    title arg to match the store_order notification's emoji pattern and keep
    it out of the translatable string.

    * Add changelog entry

diff --git a/plugins/woocommerce/changelog/update-store-stock-order-pn-icon-emoji b/plugins/woocommerce/changelog/update-store-stock-order-pn-icon-emoji
new file mode 100644
index 00000000000..94a8ac58220
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-store-stock-order-pn-icon-emoji
@@ -0,0 +1,3 @@
+Significance: patch
+Type: update
+Comment: Drop the icon from store_stock and store_order push notifications and append a per-event emoji to the store_stock title.
diff --git a/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php b/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php
index b6756411147..6ffc45e7faf 100644
--- a/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php
+++ b/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php
@@ -19,11 +19,6 @@ class NewOrderNotification extends Notification {
 	 */
 	const TYPE = 'store_order';

-	/**
-	 * The icon to use in the notification.
-	 */
-	const ICON = 'https://s.wp.com/wp-content/mu-plugins/notes/images/update-payment-2x.png';
-
 	/**
 	 * An array of emojis to select from when forming the payload.
 	 */
@@ -54,7 +49,6 @@ class NewOrderNotification extends Notification {

 		return array(
 			'type'        => $this->get_type(),
-			'icon'        => self::ICON,
 			// This represents the time the notification was triggered, so we can monitor age of notification at delivery.
 			'timestamp'   => gmdate( 'c' ),
 			'resource_id' => $this->get_resource_id(),
diff --git a/plugins/woocommerce/src/Internal/PushNotifications/Notifications/StockNotification.php b/plugins/woocommerce/src/Internal/PushNotifications/Notifications/StockNotification.php
index 42a75799277..6d6eb3bb0eb 100644
--- a/plugins/woocommerce/src/Internal/PushNotifications/Notifications/StockNotification.php
+++ b/plugins/woocommerce/src/Internal/PushNotifications/Notifications/StockNotification.php
@@ -27,7 +27,12 @@ class StockNotification extends Notification {
 		self::EVENT_ON_BACKORDER,
 	);

-	const ICON = 'https://s.wp.com/wp-content/mu-plugins/notes/images/tos-warning-note-icon.png';
+	/**
+	 * Emoji appended to the notification title, one per stock event type.
+	 */
+	const EMOJI_OUT_OF_STOCK = '🚨';
+	const EMOJI_ON_BACKORDER = '🕐';
+	const EMOJI_LOW_STOCK    = '⚠️';

 	/**
 	 * The stock event that triggered this notification.
@@ -195,7 +200,6 @@ class StockNotification extends Notification {

 		return array(
 			'type'        => $this->get_type(),
-			'icon'        => self::ICON,
 			'timestamp'   => gmdate( 'c' ),
 			'resource_id' => $this->get_resource_id(),
 			'title'       => $this->build_title( $product_name ),
@@ -277,20 +281,20 @@ class StockNotification extends Notification {
 		switch ( $this->event_type ) {
 			case self::EVENT_OUT_OF_STOCK:
 				return array(
-					'format' => 'Out of stock: %1$s',
-					'args'   => array( $product_name ),
+					'format' => 'Out of stock: %1$s %2$s',
+					'args'   => array( $product_name, self::EMOJI_OUT_OF_STOCK ),
 				);

 			case self::EVENT_ON_BACKORDER:
 				return array(
-					'format' => 'Backordered: %1$s',
-					'args'   => array( $product_name ),
+					'format' => 'Backordered: %1$s %2$s',
+					'args'   => array( $product_name, self::EMOJI_ON_BACKORDER ),
 				);

 			default:
 				return array(
-					'format' => 'Low stock: %1$s',
-					'args'   => array( $product_name ),
+					'format' => 'Low stock: %1$s %2$s',
+					'args'   => array( $product_name, self::EMOJI_LOW_STOCK ),
 				);
 		}
 	}
diff --git a/plugins/woocommerce/tests/php/src/Internal/PushNotifications/Notifications/NewOrderNotificationTest.php b/plugins/woocommerce/tests/php/src/Internal/PushNotifications/Notifications/NewOrderNotificationTest.php
index d1b52d32cd5..2f9b442fefd 100644
--- a/plugins/woocommerce/tests/php/src/Internal/PushNotifications/Notifications/NewOrderNotificationTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/PushNotifications/Notifications/NewOrderNotificationTest.php
@@ -30,7 +30,7 @@ class NewOrderNotificationTest extends WC_Unit_Test_Case {
 		$this->assertArrayHasKey( 'message', $payload );
 		$this->assertArrayHasKey( 'format', $payload['message'] );
 		$this->assertArrayHasKey( 'args', $payload['message'] );
-		$this->assertArrayHasKey( 'icon', $payload );
+		$this->assertArrayNotHasKey( 'icon', $payload );
 		$this->assertArrayHasKey( 'meta', $payload );
 		$this->assertArrayHasKey( 'order_id', $payload['meta'] );
 	}
diff --git a/plugins/woocommerce/tests/php/src/Internal/PushNotifications/Notifications/StockNotificationTest.php b/plugins/woocommerce/tests/php/src/Internal/PushNotifications/Notifications/StockNotificationTest.php
index 62bfa258d04..9bd8544fb3b 100644
--- a/plugins/woocommerce/tests/php/src/Internal/PushNotifications/Notifications/StockNotificationTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/PushNotifications/Notifications/StockNotificationTest.php
@@ -85,7 +85,7 @@ class StockNotificationTest extends WC_Unit_Test_Case {
 		$this->assertArrayHasKey( 'message', $payload );
 		$this->assertArrayHasKey( 'format', $payload['message'] );
 		$this->assertArrayHasKey( 'args', $payload['message'] );
-		$this->assertArrayHasKey( 'icon', $payload );
+		$this->assertArrayNotHasKey( 'icon', $payload );
 		$this->assertArrayHasKey( 'meta', $payload );
 		$this->assertArrayHasKey( 'product_id', $payload['meta'] );
 		$this->assertArrayHasKey( 'event_type', $payload['meta'] );
@@ -106,6 +106,21 @@ class StockNotificationTest extends WC_Unit_Test_Case {
 		$this->assertStringStartsWith( $expected_prefix, $payload['title']['format'] );
 	}

+	/**
+	 * @testdox Should include the event-specific emoji as the last title arg.
+	 * @dataProvider event_type_emoji_provider
+	 *
+	 * @param string $event_type     The event type constant.
+	 * @param string $expected_emoji The emoji expected for that event type.
+	 */
+	public function test_to_payload_title_args_contain_event_emoji( string $event_type, string $expected_emoji ): void {
+		$product      = WC_Helper_Product::create_simple_product();
+		$notification = new StockNotification( $product->get_id(), $event_type );
+		$payload      = $notification->to_payload();
+
+		$this->assertSame( $expected_emoji, $payload['title']['args'][1] );
+	}
+
 	/**
 	 * @testdox Should include stock quantity in the low_stock message args.
 	 */
@@ -411,4 +426,17 @@ class StockNotificationTest extends WC_Unit_Test_Case {
 			'on_backorder' => array( StockNotification::EVENT_ON_BACKORDER, 'Backordered:' ),
 		);
 	}
+
+	/**
+	 * Data provider mapping event types to their expected title emoji.
+	 *
+	 * @return array<string, array{string, string}>
+	 */
+	public function event_type_emoji_provider(): array {
+		return array(
+			'low_stock'    => array( StockNotification::EVENT_LOW_STOCK, StockNotification::EMOJI_LOW_STOCK ),
+			'out_of_stock' => array( StockNotification::EVENT_OUT_OF_STOCK, StockNotification::EMOJI_OUT_OF_STOCK ),
+			'on_backorder' => array( StockNotification::EVENT_ON_BACKORDER, StockNotification::EMOJI_ON_BACKORDER ),
+		);
+	}
 }