How can i get the productID from onOrderCreated function

Question:
How can i get the productID from onOrderCreated function

Product:
Wix Studio

What are you trying to achieve:
I am trying to get the event.entity.lineItems[0]._id from onOrderCreated function but all products i used to get the id it always give me 00000000-0000-0000-0000-000000000001 id.

What have you already tried:
My reference: onOrderCreated - Velo API Reference - Wix.com

My code:

export async function wixEcom_onOrderCreated(event) {
    const productID = event.entity.lineItems[0]._id;
    console.log("Product ID: " + productID);
}

Your code is fine but it’ll always get the first item in the order. For example: if user adds more than a single product in cart and buy all of them together you’ll only get the first item id.

Test your code with different products and see if you still get that same id always.

So the thing is it gives the same id for every item in my store
First order when i console.log(event.entity.lineItems)

"insertId":"..........6dY0iBF_C08OUQ28mffDPW"
"timestamp":"2024-04-17T18:27:56.318Z"
"labels":{
"siteUrl":"n/a"
"revision":"649"
"namespace":"Velo"
"tenantId":"bd7c059e-ba6e-4bc7-be87-8cf74671e2db"
"viewMode":"Site"
}
"sourceLocation":{
"file":"backend/events.js"
"line":129
"column":10
}
"operation":{
"id":"1713378443.501562080800674383"
"producer":"backend"
}
"jsonPayload":{
"message":"[[{"productName":{"original":"ÖABT Fen Bilimleri + GKGY + Eğitim Bilimleri","translated":"ÖABT Fen Bilimleri + GKGY + Eğitim Bilimleri"},"catalogReference":{"catalogItemId":"b2700ed4-1bda-6718-c6ca-9c6b1aec52e2","appId":"215238eb-22a5-4c36-9e7b-e7c08025e04e","options":{"options":{},"variantId":"00000000-0000-0000-0000-000000000000"}},"quantity":1,"totalDiscount":{"amount":"7500.0","formattedAmount":"7.500,00₺"},"descriptionLines":[],"image":"wix:image://v1/21f9a5_950a73ae29974c25a62c02a84f405444~mv2.jpeg/21f9a5_950a73ae29974c25a62c02a84f405444~mv2.jpeg#originWidth=1080&originHeight=1080",
"physicalProperties":{"sku":"","shippable":true},"itemType":{"preset":"PHYSICAL"},"price":{"amount":"7500","formattedAmount":"7.500,00₺"},"priceBeforeDiscounts":{"amount":"7500","formattedAmount":"7.500,00₺"},"totalPriceBeforeTax":{"amount":"0.0","formattedAmount":"0,00₺"},"totalPriceAfterTax":{"amount":"0.00","formattedAmount":"0,00₺"},"paymentOption":"FULL_PAYMENT_ONLINE",
"taxDetails":{"taxableAmount":{"amount":"0.00","formattedAmount":"0,00₺"},"taxRate":"0.0000","totalTax":{"amount":"0.00","formattedAmount":"0,00₺"}},"locations":[],"lineItemPrice":
{"amount":"7500","formattedAmount":"7.500,00₺"},"customLineItem":false,"
_id":"00000000-0000-0000-0000-000000000001"}]]"
}
"receiveTimestamp":"2024-04-17T18:27:56.759Z"

And the second orders console.log(event.entity.lineItems)

"root":{
"insertId":"..........466a70Kd09KP0l3bXLQ1qv"
"timestamp":"2024-04-17T19:03:23.003Z"
"labels":{
"siteUrl":"n/a"
"revision":"649"
"namespace":"Velo"
"tenantId":"bd7c059e-ba6e-4bc7-be87-8cf74671e2db"
"viewMode":"Site"
}
"sourceLocation":{
"file":"backend/events.js"
"line":129
"column":10
}
"operation":{
"id":"1713380596.6525622138037925189"
"producer":"backend"
}
"jsonPayload":{
"message":"[[{"productName":{"original":"ÖABT Beyso + GKGY + Eğitim Bilimleri","translated":"ÖABT Beyso + GKGY + Eğitim Bilimleri"},"catalogReference":{"catalogItemId":"9e94a4b3-e9cf-12aa-4b73-5dfa557ecf8b","appId":"215238eb-22a5-4c36-9e7b-e7c08025e04e","options":{"options":{},"variantId":"00000000-0000-0000-0000-000000000000"}},"quantity":1,"totalDiscount":{"amount":"7500.0","formattedAmount":"7.500,00₺"},"descriptionLines":[],"image":"wix:image://v1/21f9a5_dc309d5155d6466ba7477f2058b28b9a~mv2.jpeg/21f9a5_dc309d5155d6466ba7477f2058b28b9a~mv2.jpeg#originWidth=1080&originHeight=1080","physicalProperties":{"sku":"","shippable":true},"itemType":{"preset":"PHYSICAL"},"price":{"amount":"7500","formattedAmount":"7.500,00₺"},"priceBeforeDiscounts":{"amount":"7500","formattedAmount":"7.500,00₺"},"totalPriceBeforeTax":{"amount":"0.0","formattedAmount":"0,00₺"},"totalPriceAfterTax":{"amount":"0.00","formattedAmount":"0,00₺"},"paymentOption":"FULL_PAYMENT_ONLINE","taxDetails":{"taxableAmount":{"amount":"0.00","formattedAmount":"0,00₺"},"taxRate":"0.0000","totalTax":{"amount":"0.00","formattedAmount":"0,00₺"}},"locations":[],"lineItemPrice":{"amount":"7500","formattedAmount":"7.500,00₺"},"customLineItem":false,
"_id":"00000000-0000-0000-0000-000000000001"}]]"
}
"receiveTimestamp":"2024-04-17T19:03:23.438Z"
}

they have the same id why?

So it turns out i have to use the event.entity.lineItems[0].catalogReference.catalogItemId not event.entity.lineItems[0]._id