@@ -32,7 +32,8 @@ public function __construct(
32
32
private readonly CartRepositoryInterface $ quoteRepository ,
33
33
private readonly CustomerRepositoryInterface $ customerRepository ,
34
34
private readonly QuoteFactory $ quoteFactory
35
- ) {}
35
+ ) {
36
+ }
36
37
37
38
/**
38
39
* Create empty cart for customer without country validation
@@ -50,10 +51,9 @@ public function aroundCreateEmptyCartForCustomer(
50
51
QuoteManagement $ subject ,
51
52
Closure $ proceed ,
52
53
int $ customerId
53
- ): bool |int
54
- {
54
+ ): bool |int {
55
55
$ storeId = (int ) $ this ->storeManager ->getStore ()->getStoreId ();
56
- $ quote = $ this ->createCustomerCart ($ customerId ,$ storeId );
56
+ $ quote = $ this ->createCustomerCart ($ customerId , $ storeId );
57
57
58
58
try {
59
59
$ this ->quoteRepository ->save ($ quote );
@@ -75,14 +75,14 @@ public function aroundCreateEmptyCartForCustomer(
75
75
private function createCustomerCart (int $ customerId , int $ storeId ): Quote
76
76
{
77
77
try {
78
- $ quote = $ this ->quoteRepository ->getActiveForCustomer ($ customerId );
78
+ $ activeQuote = $ this ->quoteRepository ->getActiveForCustomer ($ customerId );
79
79
} catch (NoSuchEntityException $ e ) {
80
- $ customer = $ this ->customerRepository ->getById ($ customerId );
81
- $ quote = $ this ->quoteFactory ->create ();
82
- $ quote ->setStoreId ($ storeId );
83
- $ quote ->setCustomer ($ customer );
84
- $ quote ->setCustomerIsGuest (0 );
80
+ $ activeCustomer = $ this ->customerRepository ->getById ($ customerId );
81
+ $ activeQuote = $ this ->quoteFactory ->create ();
82
+ $ activeQuote ->setStoreId ($ storeId );
83
+ $ activeQuote ->setCustomer ($ activeCustomer );
84
+ $ activeQuote ->setCustomerIsGuest (0 );
85
85
}
86
- return $ quote ;
86
+ return $ activeQuote ;
87
87
}
88
88
}
0 commit comments