Commit e169a4c1a2 for woocommerce

commit e169a4c1a2c0498d1c7876aa014577469abb3c2a
Author: Tom Cafferkey <tjcafferkey@gmail.com>
Date:   Thu Apr 17 09:43:55 2025 +0100

    Fix undefined array key "title" warning in shipping zone methods (#57179)

    * Fallback to method_title if instance_setting['title'] is not set

    * Add changelog

    * Update to use null coalesce instead

    Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

    ---------

    Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

diff --git a/plugins/woocommerce/changelog/fix-undefined-shipping-method-title b/plugins/woocommerce/changelog/fix-undefined-shipping-method-title
new file mode 100644
index 0000000000..b885738847
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-undefined-shipping-method-title
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+
diff --git a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php
index 3c93de83d6..7c56263bb5 100644
--- a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php
+++ b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php
@@ -352,7 +352,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones
 		$method = array(
 			'id'                 => $item->instance_id,
 			'instance_id'        => $item->instance_id,
-			'title'              => $item->instance_settings['title'],
+			'title'              => $item->instance_settings['title'] ?? $item->method_title,
 			'order'              => $item->method_order,
 			'enabled'            => ( 'yes' === $item->enabled ),
 			'method_id'          => $item->id,