Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getTaxType example
self::CALCULATION_BY_WEIGHT =>
$delivery
->
getPositions
(
)
->
getWithoutDeliveryFree
(
)
->
getWeight
(
)
,
self::CALCULATION_BY_VOLUME =>
$delivery
->
getPositions
(
)
->
getWithoutDeliveryFree
(
)
->
getVolume
(
)
,
default
=>
$delivery
->
getPositions
(
)
->
getWithoutDeliveryFree
(
)
->
getLineItems
(
)
->
getPrices
(
)
->
sum
(
)
->
getTotalPrice
(
)
/ 100,
}
;
// $end (optional) exclusive
return
(
!
$start
|| FloatComparator::
greaterThanOrEquals
(
$value
,
$start
)
)
&&
(
!
$end
|| FloatComparator::
lessThanOrEquals
(
$value
,
$end
)
)
;
}
private
function
calculateShippingCosts
(
ShippingMethodEntity
$shippingMethod
, PriceCollection
$priceCollection
, LineItemCollection
$calculatedLineItems
, SalesChannelContext
$context
, ?CalculatedPrice
$manualShippingCost
= null
)
: CalculatedPrice
{
switch
(
$shippingMethod
->
getTaxType
(
)
)
{
case
ShippingMethodEntity::TAX_TYPE_HIGHEST:
$rules
=
$calculatedLineItems
->
getPrices
(
)
->
getHighestTaxRule
(
)
;
break
;
case
ShippingMethodEntity::TAX_TYPE_FIXED:
$tax
=
$shippingMethod
->
getTax
(
)
;
if
(
$tax
!== null
)
{
$rules
=
$context
->
buildTaxRules
(
$tax
->
getId
(
)
)
;