File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
app/code/Magento/Quote/Model/Observer/Backend Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,9 @@ public function dispatch(Observer $observer)
55
55
{
56
56
/** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
57
57
$ customer = $ observer ->getEvent ()->getCustomerDataObject ();
58
- /** @var \Magento\Customer\Api\Data\CustomerInterface $origCustomer */
59
- $ origCustomer = $ observer -> getEvent ()-> getOrigCustomerDataObject ( );
60
- if ($ customer ->getGroupId () !== $ origCustomer -> getGroupId ()) {
58
+ try {
59
+ $ quote = $ this -> quoteRepository -> getForCustomer ( $ customer -> getId () );
60
+ if ($ customer ->getGroupId () !== $ quote -> getCustomerGroupId ()) {
61
61
/**
62
62
* It is needed to process customer's quotes for all websites
63
63
* if customer accounts are shared between all of them
@@ -68,15 +68,13 @@ public function dispatch(Observer $observer)
68
68
: $ this ->storeManager ->getWebsites ();
69
69
70
70
foreach ($ websites as $ website ) {
71
- try {
72
- $ quote = $ this ->quoteRepository ->getForCustomer ($ customer ->getId ());
73
71
$ quote ->setWebsite ($ website );
74
72
$ quote ->setCustomerGroupId ($ customer ->getGroupId ());
75
73
$ quote ->collectTotals ();
76
74
$ this ->quoteRepository ->save ($ quote );
77
- } catch (\Magento \Framework \Exception \NoSuchEntityException $ e ) {
78
75
}
79
76
}
77
+ } catch (\Magento \Framework \Exception \NoSuchEntityException $ e ) {
80
78
}
81
79
}
82
80
}
You can’t perform that action at this time.
0 commit comments