title: Woocommerce get_cart in theme function.php get error message "get_cart() on null"
body: <p>Bellow is code that I use to get products from cart</p>
  
  <pre><code>global $woocommerce;
  $items = WC()-&gt;cart-&gt;get_cart();
  </code></pre>
  
  <p>I have this code inside functions.php in theme folder. </p>
  
  <p>The issue is every time I run this code, I always get error message saying </p>
  
  <blockquote>
    <p>"Fatal error: Call to a member function get_cart() on null"</p>
  </blockquote>
  
  <p>What did I miss ?</p>