From bdcd42602e1e91d45c5486c900f954d2dfe7e3d8 Mon Sep 17 00:00:00 2001 From: Jean-Michel Batty Date: Fri, 12 Jan 2024 12:57:31 -0600 Subject: [PATCH] hyva compatibiliy brought back a method to ensure compatibility with Extend's Hyva module --- ViewModel/Warranty.php | 20 ++++++++++++++++++++ etc/config.xml | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ViewModel/Warranty.php b/ViewModel/Warranty.php index c22f7971..fa0275f8 100644 --- a/ViewModel/Warranty.php +++ b/ViewModel/Warranty.php @@ -399,6 +399,26 @@ public function itemHasLeadWarrantyInQuote($orderItem): bool $relationSku = $this->warrantyRelation->getOfferOrderItemSku($orderItem); return !empty($this->warrantyRelation->getWarrantyByRelationSku($relationSku)); } + + /** + * Check does quote have warranty item for the item + * Kept for backwards compatibility with Hyva module + * + * @param string $sku + * @return bool + */ + public function isWarrantyInQuote(string $sku): bool + { + try { + $quote = $this->checkoutSession->getQuote(); + } catch (LocalizedException $exception) { + $quote = null; + } + if ($quote) { + $hasWarranty = $this->hasWarranty($quote, $sku); + } + return $hasWarranty ?? false; + } /** * Check does later orders have warranty item for the item diff --git a/etc/config.xml b/etc/config.xml index d3de4e03..ca713934 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -2,7 +2,7 @@ - 2.2.7 + 2.2.8 0 @@ -70,4 +70,4 @@ - \ No newline at end of file +