When using parent_id in /cart/add.js to create nested cart lines (e.g., a main product with a free gift nested underneath), the default order confirmation email renders the parent line item twice:
- Once as a standalone item in the subtotal_line_items loop (because
line.groups.size == 0and it’s not anested_line_child?) - Once as a deliverable group in the
line_item_groupsloop (with its children correctly shown underneath)
The subtotal/total calculations are correct — only the visual display is duplicated.
Steps to reproduce:
- Add items to cart via
/cart/add.jswith aparent_idfield on one of the items, creating a parent-child nested line relationship:
{
"items": [
{ "id": 1234, "quantity": 2 },
{ "id": 5678, "quantity": 1, "parent_id": 1234 }
]
}
- Complete checkout
- View the order confirmation email
Expected: The parent item appears once, with its child item nested underneath.
Actual: The parent item appears twice — once standalone (without children) and once with children nested underneath.
Checkout

