title: How to access WC() inside a PHP callback file with jQuery and .get
body: <p>I need to set a <code>WC()-&gt;set</code> inside a php jquery <code>.get</code> function.  What do I need to do inside of the php file to get access to the <code>WC()</code>. Right now it is telling me that <code>WC</code> is undefined.</p>
  
  <p>This is inside my <code>cart.php</code> file that displays the cart and shows two radio buttons for a delivery options.</p>
  
  <p>Here is the script that handles the RB change (I've simplified just to get the function to execute the reload upon return from the php query):</p>
  
  <pre><code>&lt;script&gt;
      jQuery(document).ready(function($){
  
          $("#myid").change(function(){            
  
              console.log("RB Changed!"); 
              passed_variable = "1";
  
              $.get('http://www.example.com/test.php',
              {pass_var: passed_variable}, 
              function(data, status) {
                  console.log("returned");
                  location.reload();                
                  });
           });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>And here is the PHP query:</p>
  
  <pre><code>&lt;?php
  
  global $woocommerce;
  echo "START&lt;BR&gt;";
  $temp = $_GET["pass_var"];
  
  
  WC()-&gt;session-&gt;set('_delivery_loading', $temp);
   // or 
  $woocommerce-&gt;session-&gt;set('_delivery_loading', $temp);
  
   echo "DONE[" . $temp . "]";
  
  ?&gt;
  </code></pre>