Skip to content

Commit

Permalink
hyva compatibiliy
Browse files Browse the repository at this point in the history
brought back a method to ensure compatibility with Extend's Hyva module
  • Loading branch information
jm-extend committed Jan 12, 2024
1 parent cf66150 commit bdcd426
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions ViewModel/Warranty.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<default>
<warranty>
<version>
<tag>2.2.7</tag>
<tag>2.2.8</tag>
</version>
<enableExtend>
<enable>0</enable>
Expand Down Expand Up @@ -70,4 +70,4 @@
</policies>
</csp>
</default>
</config>
</config>

0 comments on commit bdcd426

Please sign in to comment.