Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
removeLineItemsExtension example
private
function
resetDataTimestamps
(
LineItemCollection
$items
)
: void
{
foreach
(
$items
as
$item
)
{
$item
->
setDataTimestamp
(
null
)
;
$item
->
setDataContextHash
(
null
)
;
$this
->
resetDataTimestamps
(
$item
->
getChildren
(
)
)
;
}
}
private
function
removeExtensions
(
Cart
$cart
)
: void
{
$this
->
removeLineItemsExtension
(
$cart
->
getLineItems
(
)
)
;
foreach
(
$cart
->
getDeliveries
(
)
as
$delivery
)
{
$delivery
->
setExtensions
(
[
]
)
;
$delivery
->
getShippingMethod
(
)
->
setExtensions
(
[
]
)
;
foreach
(
$delivery
->
getPositions
(
)
as
$position
)
{
$position
->
setExtensions
(
[
]
)
;
$this
->
removeLineItemsExtension
(
new
LineItemCollection
(
[
$position
->
getLineItem
(
)
]
)
)
;
}
}