$lineItems =
$order->
getLineItems();
if (!
$lineItems) { return;
} $downloadIds =
[];
foreach ($lineItems->
filterGoodsFlat() as $lineItem) { $states =
$lineItem->
getStates();
if (!
$lineItem->
getDownloads() || !\
in_array(State::IS_DOWNLOAD,
$states, true
)) { continue;
} /** @var OrderLineItemDownloadEntity $download */
foreach ($lineItem->
getDownloads() as $download) { $downloadIds[] =
$download->
getId();
$download->
setAccessGranted((bool) $config['value'
]);
} } if (empty($downloadIds)) {