How Bundle (BOM) Products Work
Source: product.rb:270-282, bom_items_controller.rb:62-167
- BOM (Bill of Materials) parent product cost is auto-calculated by summing all child item costs (both ex-tax and inc-tax) -- you cannot manually set the cost of a bundle parent
- If a child product in the bundle is invalid or deleted, the parent product raises "Bundle contains an invalid or deleted product" on save
- A BOM item cannot reference its own parent product -- this prevents infinite loops; the error message includes a link to the support KB article
- BOM item line_total = quantity * price for each child item
- Updating a bundle recalculates the parent product's retail_price, cost, and cost_including_tax from the sum of all child items
- The "update_pricing" action recalculates without saving to the database -- it only returns the calculated values as JSON for preview
- BOM item destroy flag uses "1" to delete and "0" to keep; new items submitted with destroy "1" are silently skipped
- BOM item product group name falls back from child product to parent product if the child has no group
Support scenarios
- "Why did my bundle product's cost change automatically?" → Bundle costs are always recalculated from child items on every save
- "Why can't I add this product to its own bundle?" → Self-referencing BOM items are blocked to prevent infinite loops
- "Why didn't my bundle price changes save when I clicked update pricing?" → The update_pricing action only previews calculations; you must save separately
- "Bundle contains an invalid or deleted product" → One of the child products in the bundle has been deleted or is invalid; check each child item