Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DeliveryWithoutAddressException example
public
function
convertToOrder
(
Cart
$cart
, SalesChannelContext
$context
, OrderConversionContext
$conversionContext
)
: array
{
foreach
(
$cart
->
getDeliveries
(
)
as
$delivery
)
{
if
(
$delivery
->
getLocation
(
)
->
getAddress
(
)
!== null ||
$delivery
->
hasExtensionOfType
(
self::ORIGINAL_ID, IdStruct::
class
)
)
{
continue
;
}
throw
new
DeliveryWithoutAddressException
(
)
;
}
$data
= CartTransformer::
transform
(
$cart
,
$context
,
$this
->initialStateIdLoader->
get
(
OrderStates::STATE_MACHINE
)
,
$conversionContext
->
shouldIncludeOrderDate
(
)
)
;
if
(
$conversionContext
->
shouldIncludeCustomer
(
)
)
{
$customer
=
$context
->
getCustomer
(
)
;
if
(
$customer
=== null
)
{