title: Set shipping postcode early before add to cart in WooCommerce
body: <p>I would like the customers to be able to set their post code before adding a product to cart.<br>
  This post code is then saved and used to define available delivery methods.</p>
  
  <p>I've made the following functions but it's not always working and I'm not sure about which Woocommerce methods should be used and what's the difference between them:</p>
  
  <ul>
  <li><code>WC()-&gt;customer-&gt;set_shipping_postcode(...)</code> and <code>WC()-&gt;customer-&gt;get_shipping_postcode()</code></li>
  <li><code>WC()-&gt;session-&gt;set('shipping_postcode', ...)</code> and <code>WC()-&gt;session-&gt;get('shipping_postcode')</code></li>
  <li><code>update_user_meta(get_current_user_id(), 'shipping_postcode', ...)</code> and <code>get_user_meta(get_current_user_id(), 'shipping_postcode', true)</code></li>
  </ul>
  
  <p>Also, I'm saving post code for billing and shipping cause I don't know if user has previously made an order and chosen to delivered it to a shipping address different than billing address.</p>
  
  <hr>
  
  <pre><code>function getDeliveryZipcode()
  {
    $shipping_postcode = WC()-&gt;customer-&gt;get_shipping_postcode();
    $billing_postcode = WC()-&gt;customer-&gt;get_billing_postcode();
    return $shipping_postcode ? $shipping_postcode : $billing_postcode;
  }
  
  function setDeliveryZipcode()
  {
    $zipcode = $_GET['zipcode'];
  
    // ...
  
    WC()-&gt;customer-&gt;set_shipping_postcode(wc_clean($zipcode));
    WC()-&gt;customer-&gt;set_billing_postcode(wc_clean($zipcode));
  }
  </code></pre>
  
  <p>Thanks</p>