Listing a visitors cart using a repeater

Hello Wix community. I have a bit of a predicament.
I am attempting to list a users cart items in a repeater. However, my code seems to be returning an empty promise when I do it in preview mode.
When I console.log the array it seems to read correctly, it wont read in preview.
Also I tried to call one of the items in the array and it creates an error when I do inspect element using chrome.

Here’s my back end code.


import wixStores from 'wix-stores-backend'

export function getCurrentCart() {
 return wixStores.getCurrentCart();
}

and here is my site page code.
Any clues?

$w.onReady(function () {

console.log(getCurrentCart());
var currentRegInCart = getCurrentCart(); console.log(currentRegInCart.lineItems[0].customTextFields[0].value);

// handle creation of new repeated items
    $w("#registrantsInCart").onItemReady(($item, itemData, index) => {
        $w("#registrantsInCart").expand();
 
        $item("#repFirst").text = currentRegInCart.lineItems[0].customTextFields[0].value;
    });

});

any suggestions. All your help is appreciated.

1 Like

I have same issue. Did you find any solution?