Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read properties of undefined (reading 'addVariantToCart') #86

Open
muhzulzidan opened this issue Sep 9, 2021 · 0 comments

Comments

@muhzulzidan
Copy link

where to debug this particular code ? does any one know ?

i only change this productGrid to display something or not based on location

{ location.location.path==="/shop/" ? 
        allShopifyProduct.edges ? (
          allShopifyProduct.edges.map(
            ({
              node: {
                id,
                handle,
                title,
                images: [firstImage],
                variants: [firstVariant],
              },
            }) => (
              <div key={id}>
                <Link to={`/product/${handle}/`}>
                  <GatsbyImage
                    image={firstImage.gatsbyImageData}
                    alt={handle}
                  />
                </Link>
                <h2>{title}</h2>
                <p>{getPrice(firstVariant.price)}</p>
                {/* <ExchangeRate from='IDR' to='USD' value={`${firstVariant.price}`}/> */}

              </div>
            )
          )
        ) : (
          <p>No Products found!</p>
        ):
        <Carausels className="carauselsProductGrid">
          {allShopifyProduct.edges ? (
            allShopifyProduct.edges.map(
              ({
                node: {
                  id,
                  handle,
                  title,
                  images: [firstImage],
                  variants: [firstVariant],
                },
              }) => (
                <div key={id}>
                  <Link to={`/product/${handle}/`}>
                    <GatsbyImage
                      image={firstImage.gatsbyImageData}
                      alt={handle}
                    />
                  </Link>
                  <h2>{title}</h2>
                  <p>{getPrice(firstVariant.price)}</p>
                  {/* <ExchangeRate from='IDR' to='USD' value={`${firstVariant.price}`}/> */}

                </div>
              )
            )
          ) : (
            <p>No Products found!</p>
          )}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant