Hey @chiragma
You can grab the productlistitems array from the datalayer and put it into another array using the code below. This script can be used in custom code of a data element (let's call it prodList) within Launch.
// Access the productListItems array from the object
const productListItems = window.adobeDataLayer[0].product.productListItems;
// Initialize an array to store the extracted data
const extractedData = [];
// Check if productListItems is an array and not empty
if (Array.isArray(productListItems) && productListItems.length > 0) {
// Loop through the productListItems array and extract data
productListItems.forEach((item, index) => {
const extractedItem = {
index: index + 1,
Qty: item.Qty,
brand: item.brand,
category: item.category,
StarRating: item.StarRating,
sku: item.sku,
stockStatus: item.stockStatus,
};
// Push the extracted data into the new array
extractedData.push(extractedItem);
});
} else {
console.log("productListItems is either not an array or is empty.");
}
// Now you have the extracted data in the `extractedData` array
return extractedData; Once you have the above array of productlistitems, you can then map this to another data element of type, XDM Object. Once you specify the schema in the data element, you would map the prodList data element from above in the productListItem.

Please ensure you are sticking to the values you are allowed in the product list items field group. You can refer to the below: https://github.com/adobe/xdm/blob/master/docs/reference/datatypes/productlistitem.schema.json
Once you've done that, you would also need to update the commerce object for the specific ecommerce event you are passing the information for.
As for the merchandising eVars, you would need to use the Adobe Analytics Experience Event Template field group. Within that field group, you have a productlistitems array which has eVars in it. Populating eVars within this array object would function similar to merch eVars in AA.

Here's a link to detailed information around this field group.
https://experienceleague.adobe.com/docs/analytics/implementation/aep-edge/variable-mapping.html?lang=en
Hope the above should give you a start.
Reach out if you need any further information around it.
Cheers,
Abhinav