Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
PurchaseStepsError example
new
MinOrderQuantityError
(
(string)
$item
->
getReferencedId
(
)
,
(string)
$item
->
getLabel
(
)
,
$minPurchase
)
)
;
return
;
}
$fixedQuantity
=
$this
->
fixQuantity
(
$minPurchase
,
$item
->
getQuantity
(
)
,
$steps
)
;
if
(
$item
->
getQuantity
(
)
!==
$fixedQuantity
)
{
$item
->
setQuantity
(
$fixedQuantity
)
;
$cart
->
addErrors
(
new
PurchaseStepsError
(
(string)
$item
->
getReferencedId
(
)
,
(string)
$item
->
getLabel
(
)
,
$fixedQuantity
)
)
;
}
}
private
function
enrich
(
SalesChannelContext
$context
, LineItem
$lineItem
, CartDataCollection
$data
, CartBehavior
$behavior
)
: void
{
$id
=
$lineItem
->
getReferencedId
(
)
;
$product
=
$data
->
get
(
$this
->
getDataKey
(
(string)
$id
)
)
;