In order to store the inventory id for each item you should be adding it to the cart with the item. If you had a column in the cart for this value you would not have to display it but you can use it to store the inventory id for that item. Then when you are storing the details in your table you would just associate this column of the cart for that column in your table.
This is the best way to do this since the details insert loops through the cart. Getting the values from a recordset after the fact may be possible but it will require a bit of custom coding.