For anyone having this problem, I found the answer here
The relevant parts of the answer:
After digging through the Ecommerce module code of the CMS itself, I noticed, that instead of using the parent SKUID and the option SKUIDs list (like it implies in the documention), Kentico uses the variant SKUID and only puts the options of type Products into the list (in my case only one of the options).
// The optionId list includes no attributes and I use the variantSkuId
var options = optionIds.Select(c => new ShoppingCartItemParameters{ SKUID = c }).ToList();
var cartItemParams = new ShoppingCartItemParameters(variantSkuId, quantity, options);
ShoppingService.AddItemToCart(cartItemParams);
Strangly, I also have to convert the List<int>
to List<ShoppingCartItemParameters>
. If I pass the list of SKUIDs directly to new ShoppingCartItemParameters(...)
the ProductOptions
list property of cartItemParams
will be empty. It seems to ignore the list of option SKUIDs. However, when I use List<ShoppingCartItemParameters>
it works.
The documentation really should be updated to cover this, because it is almost impossible to figure out on your own.