You can try this:
import wixStores from 'wix-stores';
$w.onReady(function () {
wixStores.getCurrentCart()
.then((cartData) => {
let lineItems = cartData.lineItems;
const items = [];
for (let item of lineItems) {
let optionsName = ' ';
if (item.options && item.options.length > 0) {
for (let index = 0; index < item.options.length; index++) {
const options = item.options[index];
optionsName = optionsName.concat(`${options.option} : ${options.selection} `);
}
}
items.push(`${item.quantity} x ${item.name} | ${optionsName}`);
}
$w('#lineItems').value = items.join(`\n`)
})
.catch((error) => {
console.log(error);
});
});
It is something like getting the cart data, then ‘translate’ into human-readable language, then set the text to the form