Multiple products with options in an Order

Hi, I am building a shopping [kind of] app to keep a record of orders.
I have:

  • A products table which contains items like shirts, pants, t-shirts, etc
  • A size table that contains small, medium, and large. All products will have these 3 options.
  • A cart table containing the product and the corresponding size selected for each row.
    I can successfully add products and sizes to the cart. Now I am struggling to move all these cart items to the orders table. Each order table row should contain multiple products along with its selected size which I had in the cart when ordering.

I am sorry if this is a repeated question. I could not find a similar question which could solve my problem.
Thanks in advance.

Instead of trying to move cart items, I think you should treat your cart like a line items table. Your order row should contain a list of line item IDs to tie them together.

I do not understand what is “line items”.
This is what my cart table look like:

I mean you should treat those lines as child lines to your Order, which is the “parent”.

In your Orders table, you would have a column called “Line items”, then the value based on your screnshot would look like: “kilslcW…, zw1i2xU…, dp6EPkn…”