title: woocommerce store api + reactjs - add to cart not working
body: <p>I have a react app Im working on to create a new frontend for an already live woocommerce site. I'm using this endpoint <code>/wp-json/wc/store/v1/cart/add-item</code> like so -</p>
  <pre><code>    let config = {
      method: &quot;post&quot;,
      url: &quot;http://localhost:8010/proxy/wp-json/wc/store/v1/cart/add-item&quot;,
      data: {
        id : id,
        quantity: 1,
        variation: [
  {
    attribute: &quot;Color&quot;,
    value: color,
  },
  {
    attribute: &quot;Size&quot;,
    value: size,
  }
        ]
      }
      }
      console.log(config)
     const resp = await axios(config).then((response) =&gt; {
      console.log(response.data)
    })
    .catch((error) =&gt; {
      console.log(error.response.data);
    });
  </code></pre>
  <p>Which is giving me a successful json response showing I have the item added -
  <code>items_count: 1</code></p>
  <p>Then I have a cart component to api call and render -</p>
  <pre><code>useEffect(() =&gt; {
      getCart();
    }, []);
  
  const getCart = async () =&gt; {
      let config = {
      method: &quot;get&quot;,
      url: &quot;http://localhost:8010/proxy/wp-json/wc/store/v1/cart&quot;
      }
     await axios(config).then((response) =&gt; {
      console.log(response.data)
    })
    .catch((error) =&gt; {
      console.log(error.response.data);
    });
    }
  </code></pre>
  <p>However when navigating to this page/component or any other, the api call is returning an empty cart - <code>items_count: 0</code></p>
  <p>On the checkout page I tried using a different endpoint <code>wp-json/wc/store/v1/checkout</code> but this is giving me an error -
  <code>code: &quot;woocommerce_rest_cart_empty&quot; data: {status: 400} message: &quot;Cannot create order from empty cart.&quot;</code></p>
  <p>Any ideas why this is happening?</p>