delete group product with child from cart

Topic summary

Issue: A custom cart setup groups “child” products under a “parent” product (using the parent’s product ID), hides child items in the cart UI, and deletes children when the parent is removed.

Observed problem: After returning from checkout and adding more products, the cart sequence/order flips and child items start referencing the previous product’s parent ID. New additions cause all child items to reassign their parent to the older product’s ID, breaking the delete logic. When attempting to clear the cart, some of the last items cannot be removed.

Context notes: All child product IDs are mostly the same, which may be contributing to ID collisions/mis-associations. The setup appears to simulate grouped products in a Shopify theme (third-party theme).

Status: No resolution provided yet; user is reporting inconsistent parent–child linkage after checkout navigation, leading to failed deletions and incorrect item associations.

Summarized with AI on December 31. AI used: gpt-5.

I customize the theme also a cart page. I use my product id as a parent id and other three product as a child id.
when user select the product and add to cart I hide the child product and display only parent product. when user
delete any product I also delete child product base on parent product id.
But, issue is that when I came back from check out page and add any other product in cart the flow is change. it
print in reverse order. child consider previous product’s parent id as parent. when ever add new product all child
product parent id change to Older products parent id as their parent id. so delete functionality don’t work. when
delete all products some last products can’t delete from the cart.

*note: all child product id are mostly same