Much of the code is just for exposition (to explain what I'm doing).
For your data element, you'd paste just this much and add a return line as such:
var cartItemCount = window.digitalData.cart.item.length||0;
var productStanzas=[];
for (var i=0; i<cartItemCount; i++) {
var cartItem = window.digitalData.cart.item[i].productInfo;
var stanza=[];
stanza[0] = ""; //empty Catgeory
stanza[1] = cartItem.productID;
stanza[2] = ""; //empty quantity
stanza[3] = ""; //empty unit price
stanza[4] = ""; //empty product level events
var stanzaEvars=[];
stanzaEvars.push("eVar2="+cartItem.productName);
stanzaEvars.push("eVar3="+cartItem.productstyleNumber);
stanzaEvars.push("eVar4="+cartItem.productID);
stanzaEvars.push("eVar5="+cartItem.productCategory);
stanza[5] = stanzaEvars.join("|");
productStanzas.push(stanza.join(";"));
}
var productString = productStanzas.join(",");
return productString;