From 71ecc90d465e019276955c73a2ef4f6cde25fe5a Mon Sep 17 00:00:00 2001
From: Bob Olde Hampsink <bob@robuust.digital>
Date: Wed, 8 Jan 2025 10:13:32 +0100
Subject: [PATCH 1/2] Improve shipping methods performance

---
 src/services/ShippingMethods.php | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/services/ShippingMethods.php b/src/services/ShippingMethods.php
index 397ca760ff..45e48dd26d 100644
--- a/src/services/ShippingMethods.php
+++ b/src/services/ShippingMethods.php
@@ -125,12 +125,11 @@ public function getMatchingShippingMethods(Order $order): array
 
         /** @var ShippingMethod $method */
         foreach ($event->shippingMethods as $method) {
-            $totalPrice = $method->getPriceForOrder($order);
 
             if ($method->getIsEnabled() && $method->matchOrder($order)) {
                 $matchingMethods[$method->getHandle()] = [
                     'method' => $method,
-                    'price' => $totalPrice, // Store the price so we can sort on it before returning
+                    'price' => $method->getPriceForOrder($order), // Store the price so we can sort on it before returning
                 ];
             }
         }

From 9a5c24eb51066b70611126049ac4d730ba84139d Mon Sep 17 00:00:00 2001
From: Bob Olde Hampsink <bob@robuust.digital>
Date: Wed, 8 Jan 2025 10:19:18 +0100
Subject: [PATCH 2/2] phpcs fix

---
 src/services/ShippingMethods.php | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/services/ShippingMethods.php b/src/services/ShippingMethods.php
index 45e48dd26d..e69fe885dd 100644
--- a/src/services/ShippingMethods.php
+++ b/src/services/ShippingMethods.php
@@ -125,7 +125,6 @@ public function getMatchingShippingMethods(Order $order): array
 
         /** @var ShippingMethod $method */
         foreach ($event->shippingMethods as $method) {
-
             if ($method->getIsEnabled() && $method->matchOrder($order)) {
                 $matchingMethods[$method->getHandle()] = [
                     'method' => $method,