Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
SalesChannelContextRestoredEvent example
$restoredCart
->
addErrors
(
...
array_values
(
$guestCart
->
getErrors
(
)
->
getPersistent
(
)
->
getElements
(
)
)
)
;
$this
->
deleteGuestContext
(
$currentContext
,
$customerId
)
;
$errors
=
$restoredCart
->
getErrors
(
)
;
$result
=
$this
->cartRuleLoader->
loadByToken
(
$customerContext
,
$restoredCart
->
getToken
(
)
)
;
$cartWithErrors
=
$result
->
getCart
(
)
;
$cartWithErrors
->
setErrors
(
$errors
)
;
$this
->cartService->
setCart
(
$cartWithErrors
)
;
$this
->eventDispatcher->
dispatch
(
new
SalesChannelContextRestoredEvent
(
$customerContext
,
$currentContext
)
)
;
return
$customerContext
;
}
}