adrianhajdin/project_e_commerce

TypeError: Cannot read property 'length' of undefined

Amank-root opened this issue · 2 comments

error

can you guys plz help me with this??
errosame

trying using it this way, i dont understand why .length does'nt work either.

const isEmpty = () => {
        if (cart.line_items === 0) {
            return true
        } else {
            return false
        }
    }

If stuck, just look for any response changes from the commerce API call.
Here's how I solved it:
{!cart.line_items ? ShowEmptyCart() : ShowFilledCart()}
or
{!cart.line_items ? : }

Happy Coding! ☺