Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
addSecondShippingMethodPriceRule example
$shippingCosts
=
$delivery
->
getShippingCosts
(
)
;
static
::
assertSame
(
1,
$shippingCosts
->
getQuantity
(
)
)
;
static
::
assertSame
(
15.0,
$shippingCosts
->
getUnitPrice
(
)
)
;
static
::
assertSame
(
15.0,
$shippingCosts
->
getTotalPrice
(
)
)
;
}
public
function
testStartAndEndConditionsInPriceRule
(
)
: void
{
$priceRuleId
= Uuid::
randomHex
(
)
;
$shippingMethodId
= Uuid::
randomHex
(
)
;
$shippingMethod
=
$this
->
addSecondShippingMethodPriceRule
(
$priceRuleId
,
$shippingMethodId
)
;
$this
->salesChannelContext->
setRuleIds
(
array_merge
(
$this
->salesChannelContext->
getRuleIds
(
)
,
[
$priceRuleId
]
)
)
;
$prop
= ReflectionHelper::
getProperty
(
SalesChannelContext::
class
, 'shippingMethod'
)
;
$prop
->
setValue
(
$this
->salesChannelContext,
$shippingMethod
)
;
// create order
$cart
=
$this
->
generateDemoCart
(
)
;
$orderId
=
$this
->
persistCart
(
$cart
)
[
'orderId'
]
;
// create version of order
$versionId
=
$this
->
createVersionedOrder
(
$orderId
)
;