Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getShippingAvailable example
$country
=
$context
->
getShippingLocation
(
)
->
getCountry
(
)
;
$customer
=
$context
->
getCustomer
(
)
;
$validateShipping
=
$cart
->
getLineItems
(
)
->
count
(
)
=== 0
||
$cart
->
getLineItems
(
)
->
hasLineItemWithState
(
State::IS_PHYSICAL
)
;
if
(
!
$country
->
getActive
(
)
&&
$validateShipping
)
{
$errors
->
add
(
new
ShippingAddressBlockedError
(
(string)
$country
->
getTranslation
(
'name'
)
)
)
;
return
;
}
if
(
!
$country
->
getShippingAvailable
(
)
&&
$validateShipping
)
{
$errors
->
add
(
new
ShippingAddressBlockedError
(
(string)
$country
->
getTranslation
(
'name'
)
)
)
;
return
;
}
if
(
!
$this
->
isSalesChannelCountry
(
$country
->
getId
(
)
,
$context
)
&&
$validateShipping
)
{
$errors
->
add
(
new
ShippingAddressBlockedError
(
(string)
$country
->
getTranslation
(
'name'
)
)
)
;
return
;
}