ShoppingCartItem object

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 anni tempo fa
I have used the following code:


ShoppingCartItem sci = new ShoppingCartItem();
string sSku = sci.ProductVariant.SKU.ToString();


However, 2nd line causes an exception error as "Object reference not set to an instance of an object". Why is that?

Can somebody give me some hint on this ?

Thanks.
13 anni tempo fa
You'll have to check the code, but [I think] a shoppingcartitem will have a custom property that loads a variant by reference (id) so if you initialise a new object of type ShoppingCartItem, the product variant will probably be null, as the variant reference will be null or uninitialised.

Like I said, please check the [ShoppingCartItem class] code, as I am just guessing here.
13 anni tempo fa
Hello,

I tried it but it doesn't get me anywhere yet but I appreciate your help and comment. At least finally one person gave me reply on this. :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.