Skip to content

Commit

Permalink
Cart entity: Respect free delivery by product tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Sep 12, 2022
1 parent 8f3b92d commit c69db96
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Entity/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ public function getDeliveryPrice(?PriceInterface $itemsPrice = null): PriceInter
if ($itemsPrice === null) {
$itemsPrice = new Price('0', $this->getCurrency());
}
foreach ($this->getItems() as $item) {
foreach ($item->getProduct()->getTags() as $tag) {
if ($tag->isFreeDelivery()) {
return new Price('0', $this->getCurrency());
}
}
}
if ($this->delivery !== null
&& $itemsPrice->isSmallerThan((string) $this->runtimeContext->getFreeDeliveryLimit())
) {
Expand Down

0 comments on commit c69db96

Please sign in to comment.