Skip to content

Commit 88778bd

Browse files
authored
#23972 fix disabled guest checkout issue
1 parent f1e11ea commit 88778bd

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

app/code/Magento/Downloadable/Observer/IsAllowedGuestCheckoutObserver.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Quote\Api\Data\CartItemInterface;
1616
use Magento\Quote\Model\Quote;
1717
use Magento\Store\Model\ScopeInterface;
18+
use Magento\Store\Model\StoreManagerInterface;
1819

1920
/**
2021
* Checks if guest checkout is allowed then quote contains downloadable products.
@@ -36,14 +37,25 @@ class IsAllowedGuestCheckoutObserver implements ObserverInterface
3637
* @var LinkCollectionFactory
3738
*/
3839
private $linkCollectionFactory;
40+
41+
/**
42+
* @var StoreManagerInterface
43+
*/
44+
private $storeManager;
3945

4046
/**
4147
* @param ScopeConfigInterface $scopeConfig
4248
* @param LinkCollectionFactory $linkCollectionFactory
49+
* @param StoreManagerInterface $storeManager
4350
*/
44-
public function __construct(ScopeConfigInterface $scopeConfig, LinkCollectionFactory $linkCollectionFactory) {
51+
public function __construct(
52+
ScopeConfigInterface $scopeConfig,
53+
LinkCollectionFactory $linkCollectionFactory,
54+
StoreManagerInterface $storeManager
55+
) {
4556
$this->scopeConfig = $scopeConfig;
4657
$this->linkCollectionFactory = $linkCollectionFactory;
58+
$this->storeManager = $storeManager;
4759
}
4860

4961
/**
@@ -54,7 +66,7 @@ public function __construct(ScopeConfigInterface $scopeConfig, LinkCollectionFac
5466
*/
5567
public function execute(Observer $observer)
5668
{
57-
$storeId = (int)$observer->getEvent()->getStore()->getId();
69+
$storeId = (int)$this->storeManager->getStore($observer->getEvent()->getStore())->getId();
5870
$result = $observer->getEvent()->getResult();
5971

6072
/* @var $quote Quote */

0 commit comments

Comments
 (0)