Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isRecalculation example
$this
->eventDispatcher->
dispatch
(
new
CartLoadedEvent
(
$cart
,
$context
)
)
;
return
$cart
;
}
/** * @throws InvalidUuidException */
public
function
save
(
Cart
$cart
, SalesChannelContext
$context
)
: void
{
if
(
$cart
->
getBehavior
(
)
?->
isRecalculation
(
)
)
{
return
;
}
$shouldPersist
=
$this
->
shouldPersist
(
$cart
)
;
$event
=
new
CartVerifyPersistEvent
(
$context
,
$cart
,
$shouldPersist
)
;
$this
->eventDispatcher->
dispatch
(
$event
)
;
if
(
!
$event
->
shouldBePersisted
(
)
)
{
$this
->
delete
(
$cart
->
getToken
(
)
,
$context
)
;