TypeError: Cannot read property 'length' of undefined
Amank-root opened this issue · 2 comments
Amank-root commented
Anas1300 commented
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
}
}
Pooreffects commented
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! ☺