I am new to episerver commerce and getting to grips with it. I can't seem to find the code to show product variants on a product page. I have two requirements.
1) To show the size and colour option for a product on the details page. I need a bit of information on setting up the product in the catalog manager - unless it is just creating a product and a vairant and adding the variant to the product.
2) Second I need to show the colour options on the product list page.
1) in administration in commerce manager create a metaclass for the variation with metafields Size and Colour. in catalog in commerce manager create new entries of type variation/sku that uses that metaclass. in catalog in commerce manager create a new entry of type product and add variations/skus below the tab variations/skus.
2) In the display template access the variations/skus by accessing the Entry.Entries property. To access the values of the metafields of the variation use Entry.Entries.Entry[x].ItemAttributes.Attribute.FirstOrDefault(attr => attr.Name == "Size").Value and Entry.Entries.Entry[x].ItemAttributes.Attribute.FirstOrDefault(attr => attr.Name == "Colour").Value. Distinctly get the values and present it in the in the display template. When the user har selected a size and colour use these values to do a reverse lookup of which variation/sku thats matches these item attributes.
Hope this helps.
Thank you very much for your response. This is exactly what I was looking for.