# Produkte löschen nicht möglich

**URL:** <https://forum.shopware.com/t/produkte-loeschen-nicht-moeglich/108330>\
**Category:** Shopware 6 (German)\
**Created:** [8. Dezember 2025 um 09:34 UTC](https://forum.shopware.com/t/produkte-loeschen-nicht-moeglich/108330 "2025-12-08T09:34:14Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![kay-1980](https://avatars.discourse-cdn.com/v4/letter/k/db5fbb/32.png) [@kay-1980](https://forum.shopware.com/u/kay-1980)\
**Post date:** [20. Dezember 2025 um 13:52 UTC](https://forum.shopware.com/t/produkte-loeschen-nicht-moeglich/108330/16 "2025-12-20T13:52:47Z")

</div>

Ich habe jetzt den ProductSubscriper angepasst:

> // Clean up configurator settings for parents that no longer have variants using those options
> 
> // Filtere Parent-IDs: keine NULLs, keine leeren Strings, nur gültige Hex-Zeichen  
> $parentIdsFiltered = array\_filter($parentIds, fn($id) =\> !empty($id) && ctype\_xdigit($id));
> 
> if (empty($parentIdsFiltered)) {  
> // Keine gültigen Parent-IDs → Query komplett überspringen  
> return;  
> }
> 
> // Hex-Strings in Binary konvertieren  
> $parentIdsBinary = array\_map(fn($id) =\> hex2bin($id), $parentIdsFiltered);
> 
> // Nur ausführen, wenn Binary-Array nicht leer ist  
> if (count($parentIdsBinary) === 0) {  
> return;  
> }
> 
> // Query ausführen: Verwaiste configurator\_settings löschen  
> $this-\>connection-\>executeStatement(  
> ‚DELETE FROM product\_configurator\_setting pcs  
> WHERE pcs.product\_id IN (:parentIds)  
> AND pcs.product\_version\_id = :versionId  
> AND NOT EXISTS (  
> SELECT 1  
> FROM product\_option po  
> INNER JOIN product p ON p.id = po.product\_id AND p.version\_id = po.product\_version\_id  
> WHERE p.parent\_id = pcs.product\_id  
> AND p.version\_id = :versionId  
> AND po.property\_group\_option\_id = pcs.property\_group\_option\_id  
> AND po.product\_version\_id = :versionId  
> )‘,  
> [  
> ‚parentIds‘ =\> $parentIdsBinary,  
> ‚versionId‘ =\> $versionBytes,  
> ],  
> [  
> ‚parentIds‘ =\> ArrayParameterType::BINARY,  
> ]  
> );

KEINE Garantie

---

_[View the full topic](https://forum.shopware.com/t/produkte-loeschen-nicht-moeglich/108330)._
