This comes through GTM as an object
that I have to convert to an array
, so that I can loop through it.
I've written a forEach
statement for it, but I can't seem to format this properly to work.
(full disclosure, I'm not a developer, I'm just trying to muddle my way through GTM)
I've tried using Object.entries(obj)
, but the result was multiple arrays
.
{
0: {
category_id: '',
cart_entry_id: 0,
quantity: 3,
product_id: '678294',
unit_price: 5.29,
product_name: 'Office Depot® Brand 8-Pocket Poly Organizer, Assorted Colors (No Color Choice)',
},
2: {
category_id: '543867',
cart_entry_id: 2,
quantity: 1,
product_id: '448906',
unit_price: 34.99,
product_name: 'Realspace® All-Pile Studded Chair Mat, 36" x 48";, Clear',
},
3: {
category_id: '543867',
cart_entry_id: 3,
quantity: 1,
product_id: '493876',
unit_price: 179.99,
product_name: 'Realspace® MFTC 200 Mesh Multifunction Ergonomic Mid-Back Task Chair, Black',
}
}