public function on_woocommerce_init()
 {
     if ((!is_admin() || defined('DOING_AJAX')) && !defined('DOING_CRON')) {
         //We need to force WooCommerce to set the session cookie
         if (!WC_Catalog_Visibility_Compatibility::WC()->session->has_session()) {
             WC_Catalog_Visibility_Compatibility::WC()->session->set_customer_session_cookie(true);
         }
     }
 }
 public function get_location_for_current_user()
 {
     global $woocommerce;
     $location = false;
     if (is_user_logged_in()) {
         $location = get_user_meta(get_current_user_id(), '_wc_location', true);
     }
     if (!empty($location)) {
         return $location;
     }
     $session =& WC_Catalog_Visibility_Compatibility::WC()->session;
     $location = isset($session) && isset($session->wc_location) ? $session->wc_location : '';
     if (empty($location) && function_exists('wc_get_customer_default_location') && $this->get_setting('_wc_restrictions_locations_use_geo', 'yes') == 'yes') {
         $l = wc_get_customer_default_location();
         if (isset($l['country'])) {
             $location = $l['country'];
         }
     }
     return apply_filters('woocommerce_catalog_restrictions_get_user_location', $location);
 }
 public function get_cached_exclusions($type, $session_id = false)
 {
     global $woocommerce;
     if ($session_id === false) {
         $session_id = WC_Catalog_Visibility_Compatibility::WC()->session->get_customer_id();
     }
     return get_transient('twccr_' . $session_id . '_' . $type);
 }