6 declare(strict_types=1);
11 use Magento\OfflineShipping\Model\SalesRule\ExtendedCalculator;
51 $addressFreeShipping =
true;
52 $store = $this->storeManager->getStore(
$quote->getStoreId());
53 $this->calculator->init(
55 $quote->getCustomerGroupId(),
62 if (
$item->getNoDiscount()) {
63 $addressFreeShipping =
false;
64 $item->setFreeShipping(
false);
69 if (
$item->getParentItemId()) {
73 $this->calculator->processFreeShipping(
$item);
75 if ((
bool)
$item->getAddress()->getFreeShipping()) {
80 $itemFreeShipping = (bool)
$item->getFreeShipping();
81 $addressFreeShipping = $addressFreeShipping && $itemFreeShipping;
97 if (
$item->getHasChildren() &&
$item->isChildrenCalculated()) {
98 foreach (
$item->getChildren() as $child) {
99 $this->calculator->processFreeShipping($child);
100 if ($isFreeShipping) {
101 $child->setFreeShipping($isFreeShipping);
113 private function applyToItems(array
$items,
bool $freeShipping)
118 ->setFreeShipping((
int)$freeShipping);
applyToChildren(\Magento\Quote\Model\Quote\Item\AbstractItem $item, $isFreeShipping)
__construct(StoreManagerInterface $storeManager, Calculator $calculator)
isFreeShipping(\Magento\Quote\Model\Quote $quote, $items)