project_e_commerce icon indicating copy to clipboard operation
project_e_commerce copied to clipboard

TypeError: Cannot read property 'length' of undefined

Open Amank-root opened this issue 3 years ago • 2 comments

error

can you guys plz help me with this?? errosame

Amank-root avatar May 04 '21 06:05 Amank-root

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
        }
    }

Anas1300 avatar May 27 '21 12:05 Anas1300

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 ? <ShowEmptyCart /> : <ShowFilledCart />}

Happy Coding! ☺

Pooreffects avatar Nov 12 '21 00:11 Pooreffects