fix the build

This commit is contained in:
Kamil Grygierzec 2024-06-05 12:41:41 +02:00
parent d37daa380f
commit dd39c91755
No known key found for this signature in database
GPG key ID: 7F54EE42DAD4B9E9
2 changed files with 8 additions and 4 deletions

View file

@ -8,7 +8,6 @@ Feature: Receiving discounts with product minimum price specified
Given the store operates on a single channel in "United States"
And the store ships everywhere for Free
And the store allows paying Offline
And I am a logged in customer
And the store classifies its products as "T-Shirts"
And the store has a "T-Shirt" configurable product
And this product has "PHP T-Shirt" variant priced at "$50.00"

View file

@ -25,7 +25,7 @@ final class OrderAdjustmentsVoter extends Voter
protected function supports(string $attribute, mixed $subject): bool
{
return $subject instanceof Collection;
return $subject instanceof Collection || $subject instanceof AdjustmentInterface;
}
public function supportsAttribute(string $attribute): bool
@ -48,8 +48,13 @@ final class OrderAdjustmentsVoter extends Voter
/** @var OrderInterface $order */
$order = $item->getOrder();
} else {
/** @var OrderInterface $order */
$order = $item->getOrderItem()->getOrder();
if ($item->getOrderItem()){
/** @var OrderInterface $order */
$order = $item->getOrderItem()->getOrder();
} else {
/** @var OrderInterface $order */
$order = $item->getOrderItemUnit()->getOrderItem()->getOrder();
}
}
if (!$order->isCreatedByGuest() || $order->getUser()) {