{"action":"created","issue":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/7791","labels_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7791/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7791/comments","events_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7791/events","html_url":"https://github.com/woothemes/woocommerce/issues/7791","id":63383505,"number":7791,"title":"A formal parent-child model for cart and order items","user":{"login":"franticpsyx","id":1783726,"avatar_url":"https://avatars.githubusercontent.com/u/1783726?v=3","gravatar_id":"","url":"https://api.github.com/users/franticpsyx","html_url":"https://github.com/franticpsyx","followers_url":"https://api.github.com/users/franticpsyx/followers","following_url":"https://api.github.com/users/franticpsyx/following{/other_user}","gists_url":"https://api.github.com/users/franticpsyx/gists{/gist_id}","starred_url":"https://api.github.com/users/franticpsyx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franticpsyx/subscriptions","organizations_url":"https://api.github.com/users/franticpsyx/orgs","repos_url":"https://api.github.com/users/franticpsyx/repos","events_url":"https://api.github.com/users/franticpsyx/events{/privacy}","received_events_url":"https://api.github.com/users/franticpsyx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/woothemes/woocommerce/labels/Needs%20Dev%20Feedback","name":"Needs Dev Feedback","color":"a46497"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-21T09:50:41Z","updated_at":"2015-03-27T15:46:10Z","closed_at":"2015-03-27T15:46:10Z","body":"In many product types (core & non-core) a parent/child relationship is implied between a container item and one or more grouped (child) items, such as:\r\n\r\n- Variable products + variations\r\n- Grouped products\r\n- Bundles\r\n- Composites\r\n- Mix and match products\r\n\r\nIn all of these types, the parent / child relationship includes some form of grouping (or inheritance) in relation to:\r\n\r\n- Accounting -- static value, content-based value, or combination\r\n- Inventory -- managed at parent level, child level or both\r\n- Shipping -- parent is a physical item with a static weight (or a content-based weight), children are physical items with properties defined at child level, or a combination of both\r\n- Reporting -- ability to report totals/sales at parent level or child level, without affecting order totals\r\n- Payment -- payment gateways should see the parent or the children (with some helpful meta attached), but not both in most cases\r\n- Formatting -- cart, order, e-mail templates\r\n\r\nThese product types could all benefit from a formal definition and implementation of a product group model in core, possibly including:\r\n\r\nAn abstract product group class with suitable abstract methods (such as `get_{min/max}_{regular/sale}_price`, `is_priced_per_item`, `is_shipped_per_item`, etc)\r\nCart methods for container vs contained items, as well as methods for establishing links between them and methods to abstract products from cart items (such as `get_cart_item_price`, `get_cart_item_weight`, `get_cart_item_children`, `has_cart_item_children`, `get_cart_item_container`, `is_cart_item_grouped`, `cart_item_needs_shipping`, etc)\r\nSimilar order methods\r\nPossibly amendments to the reporting classes\r\n\r\nAt the moment, not having a formal parent/child model makes integrations with 3rd party shipping / inventory management providers/systems difficult, because all the above needs to be implemented on a type-and-extension/integration-specific manner. \r\n\r\nThe biggest issue is at the order/reporting level, where the lack of a formal parent/child api means that it is difficult to maintain complete accounting, inventory, shipping, reporting and formatting consistency without sacrificing flexibility, and even more difficult for 3rd parties to access meaningful order content when such functionality is provided at extension-level.\r\n\r\nIt's a huge undertaking, but is there any medium/long term interest for this, or is it too complex / out-of-scope to include in core?\r\n\r\nloosely related: #7776"},"comment":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/comments/86980986","html_url":"https://github.com/woothemes/woocommerce/issues/7791#issuecomment-86980986","issue_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7791","id":86980986,"user":{"login":"mikejolley","id":90977,"avatar_url":"https://avatars.githubusercontent.com/u/90977?v=3","gravatar_id":"","url":"https://api.github.com/users/mikejolley","html_url":"https://github.com/mikejolley","followers_url":"https://api.github.com/users/mikejolley/followers","following_url":"https://api.github.com/users/mikejolley/following{/other_user}","gists_url":"https://api.github.com/users/mikejolley/gists{/gist_id}","starred_url":"https://api.github.com/users/mikejolley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikejolley/subscriptions","organizations_url":"https://api.github.com/users/mikejolley/orgs","repos_url":"https://api.github.com/users/mikejolley/repos","events_url":"https://api.github.com/users/mikejolley/events{/privacy}","received_events_url":"https://api.github.com/users/mikejolley/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T15:46:09Z","updated_at":"2015-03-27T15:46:09Z","body":"Definitely an interesting one. I wonder if there is room to standardize these across extensions before rolling into core? Moving the discussion to https://trello.com/c/5fuuDTBg/68-a-formal-parent-child-model-for-cart-and-order-items for voting an discussion since this isn't ready to be assigned to a milestone :)"}}