Commit 0e5d49b3d38 for woocommerce

commit 0e5d49b3d38dd08505bdcc235a1aab031e058b2a
Author: Andrey <akidinov@gmail.com>
Date:   Mon Aug 17 14:53:23 2026 +0200

    Fix receipt fatal when a filter sets a non-string payment method (#67763)

    * Cast the receipt payment method title before trimming it

    The value reaches the template through the public
    woocommerce_printable_order_receipt_data filter, so a callback can make it
    a non-string and trim() then fatals receipt generation.

    * Check the card-info arm first so the title cast short-circuits

    In card-info mode the payment method title is never printed, so casting and
    trimming it there only risks a spurious array-to-string warning.

diff --git a/plugins/woocommerce/changelog/fix-receipt-payment-method-non-string b/plugins/woocommerce/changelog/fix-receipt-payment-method-non-string
new file mode 100644
index 00000000000..14f5a5d517c
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-receipt-payment-method-non-string
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Cast the payment method title to string on printed order receipts so a non-string value from the woocommerce_printable_order_receipt_data filter no longer fatals receipt generation.
diff --git a/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php b/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php
index 5ac085642c5..6d6265ab789 100644
--- a/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php
+++ b/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php
@@ -22,7 +22,7 @@
 	<h3 id="payment_status_section_title"><?php echo strtoupper( $data['texts']['payment_status_section_title'] ); ?></h3>
 	<p><?php echo $data['texts']['payment_status']; ?></p>

-	<?php if ( isset( $data['payment_method'] ) && ( '' !== trim( $data['payment_method'] ) || ! $data['show_payment_method_title'] ) ) { ?>
+	<?php if ( isset( $data['payment_method'] ) && ( ! $data['show_payment_method_title'] || '' !== trim( (string) $data['payment_method'] ) ) ) { ?>
 		<h3 id="payment_method_section_title"><?php echo strtoupper( $data['texts']['payment_method_section_title'] ); ?></h3>
 		<p>
 			<?php if ( $data['show_payment_method_title'] ) { ?>