Skip to content

Commit

Permalink
#23972 fix disabled guest checkout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-sviziev authored Jun 10, 2020
1 parent f1e11ea commit 88778bd
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Magento\Quote\Api\Data\CartItemInterface;
use Magento\Quote\Model\Quote;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\StoreManagerInterface;

/**
* Checks if guest checkout is allowed then quote contains downloadable products.
Expand All @@ -36,14 +37,25 @@ class IsAllowedGuestCheckoutObserver implements ObserverInterface
* @var LinkCollectionFactory
*/
private $linkCollectionFactory;

/**
* @var StoreManagerInterface
*/
private $storeManager;

/**
* @param ScopeConfigInterface $scopeConfig
* @param LinkCollectionFactory $linkCollectionFactory
* @param StoreManagerInterface $storeManager
*/
public function __construct(ScopeConfigInterface $scopeConfig, LinkCollectionFactory $linkCollectionFactory) {
public function __construct(
ScopeConfigInterface $scopeConfig,
LinkCollectionFactory $linkCollectionFactory,
StoreManagerInterface $storeManager
) {
$this->scopeConfig = $scopeConfig;
$this->linkCollectionFactory = $linkCollectionFactory;
$this->storeManager = $storeManager;
}

/**
Expand All @@ -54,7 +66,7 @@ public function __construct(ScopeConfigInterface $scopeConfig, LinkCollectionFac
*/
public function execute(Observer $observer)
{
$storeId = (int)$observer->getEvent()->getStore()->getId();
$storeId = (int)$this->storeManager->getStore($observer->getEvent()->getStore())->getId();
$result = $observer->getEvent()->getResult();

/* @var $quote Quote */
Expand Down

0 comments on commit 88778bd

Please sign in to comment.