Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
MinOrderQuantityError example
$cart
->
addErrors
(
new
ProductStockReachedError
(
(string)
$item
->
getReferencedId
(
)
,
(string)
$item
->
getLabel
(
)
,
$maxAvailable
)
)
;
return
;
}
if
(
$item
->
getQuantity
(
)
<
$minPurchase
)
{
$item
->
setQuantity
(
$minPurchase
)
;
$cart
->
addErrors
(
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
)
)
;