Commit 8df62d7dea5 for woocommerce

commit 8df62d7dea5c8c3894a75f006a0ae170dfb255cc
Author: Taha Paksu <3295+tpaksu@users.noreply.github.com>
Date:   Tue Nov 17 11:34:19 2026 +0300

    Show the fulfilled items in plain emails without tracking details (#71029)

    * [WOOPLUG-8255] List the fulfilled items in plain emails without tracking info

    * Add changefile(s) from automation for the following project(s): woocommerce

    ---------

    Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>

diff --git a/plugins/woocommerce/changelog/71029-wooplug-8255-plain-fulfillment-email-items b/plugins/woocommerce/changelog/71029-wooplug-8255-plain-fulfillment-email-items
new file mode 100644
index 00000000000..94afb7d7cc3
--- /dev/null
+++ b/plugins/woocommerce/changelog/71029-wooplug-8255-plain-fulfillment-email-items
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Show the fulfilled items in plain text fulfillment emails when the shipment has no tracking details.
diff --git a/plugins/woocommerce/templates/emails/plain/email-fulfillment-details.php b/plugins/woocommerce/templates/emails/plain/email-fulfillment-details.php
index 8a13dfca18c..45b6e3d3ad3 100644
--- a/plugins/woocommerce/templates/emails/plain/email-fulfillment-details.php
+++ b/plugins/woocommerce/templates/emails/plain/email-fulfillment-details.php
@@ -12,7 +12,7 @@
  *
  * @see https://woocommerce.com/document/template-structure/
  * @package WooCommerce\Templates\Emails\Plain
- * @version 11.3.0
+ * @version 11.4.0
  */

 use Automattic\WooCommerce\Admin\Features\Fulfillments\FulfillmentUtils;
@@ -24,8 +24,7 @@ if ( null === $fulfillment->get_date_deleted() ) {
 	$tracking_url      = $fulfillment->get_meta( '_tracking_url' );
 	$shipment_provider = $fulfillment->get_meta( '_shipment_provider' );
 	if ( ! $tracking_number && ! $tracking_url && ! $shipment_provider ) {
-		echo esc_html__( 'No tracking information available for this fulfillment at the moment.', 'woocommerce' );
-		return;
+		echo esc_html__( 'No tracking information available for this fulfillment at the moment.', 'woocommerce' ) . "\n\n";
 	} else {
 		echo esc_html__( 'Tracking Number', 'woocommerce' ) . ': ' . esc_attr( $tracking_number ) . "\n";
 		echo esc_html__( 'Shipment Provider', 'woocommerce' ) . ': ' . esc_html( FulfillmentUtils::get_provider_display_name( $fulfillment ) ) . "\n";
diff --git a/plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php b/plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php
index 1a25941b8e2..191fd246b58 100644
--- a/plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php
+++ b/plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php
@@ -160,6 +160,82 @@ class WC_Emails_Tests extends \WC_Unit_Test_Case {
 		$this->assertStringContainsString( 'test_meta_value', $content );
 	}

+	/**
+	 * @testdox Plain fulfillment details list the fulfilled items when the fulfillment has no tracking information.
+	 */
+	public function test_plain_fulfillment_details_list_items_without_tracking_information(): void {
+		$order       = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::create_order();
+		$fulfillment = $this->create_fulfillment_covering_order( $order );
+
+		$content = $this->render_plain_fulfillment_details( $order, $fulfillment );
+
+		$this->assertStringContainsString( 'No tracking information available', $content, 'The missing tracking notice should still show' );
+		$this->assertStringContainsString( 'Fulfillment summary', $content, 'The summary should render without tracking information' );
+		foreach ( $order->get_items() as $item ) {
+			$this->assertStringContainsString( $item->get_name(), $content, 'Every fulfilled item should be listed' );
+		}
+	}
+
+	/**
+	 * @testdox Plain fulfillment details list the fulfilled items when the fulfillment has tracking information.
+	 */
+	public function test_plain_fulfillment_details_list_items_with_tracking_information(): void {
+		$order       = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::create_order();
+		$fulfillment = $this->create_fulfillment_covering_order( $order );
+		$fulfillment->add_meta_data( '_tracking_number', '1Z999AA10123456784', true );
+
+		$content = $this->render_plain_fulfillment_details( $order, $fulfillment );
+
+		$this->assertStringContainsString( '1Z999AA10123456784', $content, 'The tracking number should show' );
+		$this->assertStringContainsString( 'Fulfillment summary', $content, 'The summary should render with tracking information' );
+		foreach ( $order->get_items() as $item ) {
+			$this->assertStringContainsString( $item->get_name(), $content, 'Every fulfilled item should be listed' );
+		}
+	}
+
+	/**
+	 * Build an unsaved fulfillment covering every item of the order.
+	 *
+	 * @param WC_Order $order The order to fulfill.
+	 * @return Fulfillment
+	 */
+	private function create_fulfillment_covering_order( WC_Order $order ): Fulfillment {
+		$items = array();
+		foreach ( $order->get_items() as $item_id => $item ) {
+			$items[] = array(
+				'item_id' => $item_id,
+				'qty'     => $item->get_quantity(),
+			);
+		}
+
+		$fulfillment = new Fulfillment();
+		$fulfillment->set_items( $items );
+
+		return $fulfillment;
+	}
+
+	/**
+	 * Render the plain text fulfillment details for an order.
+	 *
+	 * @param WC_Order    $order The order the details are about.
+	 * @param Fulfillment $fulfillment The fulfillment the details are about.
+	 * @return string
+	 */
+	private function render_plain_fulfillment_details( WC_Order $order, Fulfillment $fulfillment ): string {
+		$bootstrap = \WC_Unit_Tests_Bootstrap::instance();
+		require_once $bootstrap->plugin_dir . '/includes/emails/class-wc-email.php';
+		require_once $bootstrap->plugin_dir . '/includes/emails/class-wc-email-customer-fulfillment-created.php';
+
+		// Called directly rather than through its action: both that hook and the email class are
+		// only loaded when the fulfillments feature is on, and WC_Emails freezes its hooks when it
+		// is first constructed. The email is still passed, because the template hands it to its hooks.
+		$email_object = new WC_Emails();
+		ob_start();
+		$email_object->fulfillment_details( $order, $fulfillment, false, true, new WC_Email_Customer_Fulfillment_Created() );
+
+		return (string) ob_get_clean();
+	}
+
 	/**
 	 * Build a valid set of arguments for WC_Emails::backorder().
 	 *