Can't fetch all Products?

Legz444
New Member
2 0 0

Hey all!

I have been fetching from the Shopify api. At first everything was coming through effortlessly, but now after adding a variety of new products on the dashboard, only some of them are showing. All the products are set to active on the Shopify dashboard. Using React. No errors coming up. Any Ideas?

 

Code:

 

class Store extends Component {
      // create a constructor for the component
  constructor(){
    super();
  //set initial state of the application
    this.state ={
      isCartOpen: false,
      checkout: { lineItems: [] },
      products: [],
      collection: [],
      shop: {}
    };
  // set each of the functions to this state with bind()

  this.handleCartClose = this.handleCartClose.bind(this);
  this.addItemToCart = this.addItemToCart.bind(this);
  this.updateQuantityInCart = this.updateQuantityInCart.bind(this);
  this.removeLineItemInCart = this.removeLineItemInCart.bind(this); 
}

  // create functions

    componentWillMount() {
        this.props.client.checkout.create().then((res) => {
            this.setState({
                checkout: res
            });
        });
        this.props.client.product.fetchAll().then((res) => {
            this.setState({
                products: res
            });
            console.log(this.state.products);
        });
        this. props.client.shop.fetchInfo().then((res) => {
            this.setState({
                shop: res
            });
        });
    }

 

 

Replies 0 (0)