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

Small typo? Also products not showing #2

Open
rowanhen opened this issue Aug 17, 2021 · 1 comment
Open

Small typo? Also products not showing #2

rowanhen opened this issue Aug 17, 2021 · 1 comment

Comments

@rowanhen
Copy link

rowanhen commented Aug 17, 2021

In src/store/shopify/action.ts -

function updateQuantityInCart(id: string | number, quantity: number) {
    const { shopify } = store.getState();
    const { cart, client } = shopify;
    if (client && cart) {
        const checkoutId = cart.id;
        client.checkout.updateLineItem(checkoutId, [{ id, quantity }]);
    }
}

This code gave error -

Property 'updateLineItem' does not exist on type 'CheckoutResource'. Did you mean 'updateLineItems'?

Just changed the .updateLineItem to .updateLineItems

I am also not able to load any products from my store - just the Loading... from this statement

if (products) {
    return (
      <div className="Product-wrapper">
        {products
          .map((product: Product) => {
            return (
              <ProductComponent
                key={product.id}
                product={product}
              />
            );
          })
          .reverse()}
      </div>
    );
  } else {
    return <p>Loading...</p>;
  }

Any help on why this is happening? Everything else seems to be working fine.

@rowanhen
Copy link
Author

To go further into detail I think the problem is occurring in src/components/shopify/Products.tsx

This if statement is coming out as false

  if (products != null) {
    return (
      <div className="Product-wrapper">
        {products
          .map((product: Product) => {
            return (
              <ProductComponent
                key={product.id}
                product={product}
              />
            );
          })
          .reverse()}
      </div>
    );
  } else {
    return <p>Loading...</p>;
  }

So no products are being shown - I am unsure of whats happening in this section, I have tried comparing to the https://github.com/Shopify/storefront-api-examples/tree/master/react-js-buy repo but there's nothing clear that stands out to me.

The products also dont show remotely or locally

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