15
15
use Magento \Quote \Api \Data \CartItemInterface ;
16
16
use Magento \Quote \Model \Quote ;
17
17
use Magento \Store \Model \ScopeInterface ;
18
+ use Magento \Store \Model \StoreManagerInterface ;
18
19
19
20
/**
20
21
* Checks if guest checkout is allowed then quote contains downloadable products.
@@ -36,14 +37,25 @@ class IsAllowedGuestCheckoutObserver implements ObserverInterface
36
37
* @var LinkCollectionFactory
37
38
*/
38
39
private $ linkCollectionFactory ;
40
+
41
+ /**
42
+ * @var StoreManagerInterface
43
+ */
44
+ private $ storeManager ;
39
45
40
46
/**
41
47
* @param ScopeConfigInterface $scopeConfig
42
48
* @param LinkCollectionFactory $linkCollectionFactory
49
+ * @param StoreManagerInterface $storeManager
43
50
*/
44
- public function __construct (ScopeConfigInterface $ scopeConfig , LinkCollectionFactory $ linkCollectionFactory ) {
51
+ public function __construct (
52
+ ScopeConfigInterface $ scopeConfig ,
53
+ LinkCollectionFactory $ linkCollectionFactory ,
54
+ StoreManagerInterface $ storeManager
55
+ ) {
45
56
$ this ->scopeConfig = $ scopeConfig ;
46
57
$ this ->linkCollectionFactory = $ linkCollectionFactory ;
58
+ $ this ->storeManager = $ storeManager ;
47
59
}
48
60
49
61
/**
@@ -54,7 +66,7 @@ public function __construct(ScopeConfigInterface $scopeConfig, LinkCollectionFac
54
66
*/
55
67
public function execute (Observer $ observer )
56
68
{
57
- $ storeId = (int )$ observer ->getEvent ()->getStore ()->getId ();
69
+ $ storeId = (int )$ this -> storeManager -> getStore ( $ observer ->getEvent ()->getStore () )->getId ();
58
70
$ result = $ observer ->getEvent ()->getResult ();
59
71
60
72
/* @var $quote Quote */
0 commit comments