In today's tutorial, you will learn how to query the Episerver Commerce catalogue in order to get products and variant data out of it. If you want to learn how to be an Episerver Commerce BOSS, read on 🔥🔥🔥
Querying Using The Product Code: If you need to get a reference to a product and you know the catalogue, production or SKU code, you can use the ReferenceConverter
API:
As shown on Line 4, passing the product code into GetContentLink()
will give you a reference to the item.
Querying Using The Product Id: GetContentLink()
also has an overload that will return a reference based on the product Id:
An important thing to note is that you will also need to supply the contents WorkId
if you want to use this approach.
Retrieving The Entry Id: After you have access to a ContentReference
you can use the GetObjectId()
method to get the items entry id:
In today's guide, we've covered the different ways of retrieving products or variants from Episerver commerce. All products and variants have a unique code, sometimes known as an SKU, that is associated with it. If you know this SKU, you can EASILY find a product via the code. Happy Coding 🤘