The CommerceItem has two properties, catalogRefId and catalogId.
I always forget which one is which so I am writing this post so I can remember. I guess it was because some companies have different conventions about SKU’s and products.
ATG | Real World |
---|---|
catalogRefId | SKU ID |
catalogId | Product ID |
Maybe one day someone will explain the reason for the naming.
Note that sometimes the catalogId is null though I’ve never seen the catalogRefId be null.
You can also try to get the product ID by using the auxiliaryData property. This property has a productId property.