Ok my end goal here is basically when an admin creates a product they can choose which sizes are only available for selection by the end user when adding to cart, sometimes multiple choice sometimes only one choice. for example, one size only, small, medium etc…
heres my product schema
schema "products" do
field :category, :string
field :description, :string
field :image, Qcrafts.Images.Type
field :name, :string
field :price, :decimal
field :slug, ProductSlug.Type
timestamps()
end
And my line_item
embedded_schema do
field :product_id, :integer
field :image, Qcrafts.Images.Type
field :product_name, :string
field :quantity, :integer
field :unit_price, :decimal
field :total, :decimal
field :delete, :boolean, virtual: true
end
Which relationships do I need and whats the best way to handle it on the template?
I have a vague idea but would just like expert opinion.
Thanks in advance.