Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
validateOrder example
/** * @throws CustomerNotLoggedInException * @throws CartException * @throws DeliveryWithoutAddressException * @throws EmptyCartException * @throws InconsistentCriteriaIdsException */
public
function
recalculateOrder
(
string
$orderId
, Context
$context
)
: void
{
$order
=
$this
->
fetchOrder
(
$orderId
,
$context
)
;
$this
->
validateOrder
(
$order
,
$orderId
)
;
\
assert
(
$order
instanceof OrderEntity
)
;
$salesChannelContext
=
$this
->orderConverter->
assembleSalesChannelContext
(
$order
,
$context
)
;
$cart
=
$this
->orderConverter->
convertToCart
(
$order
,
$context
)
;
$recalculatedCart
=
$this
->
recalculateCart
(
$cart
,
$salesChannelContext
)
;
$conversionContext
=
(
new
OrderConversionContext
(
)
)
->
setIncludeCustomer
(
false
)
->
setIncludeBillingAddress
(
false
)
->
setIncludeDeliveries
(
true
)
->
setIncludeTransactions
(
false
)