D
D
denism3002020-07-27 21:14:08
WooCommerce
denism300, 2020-07-27 21:14:08

Why doesn't the value in WC->session change?

I want to set a value to the WC session, I wrote a function:

function set_user_type_func()
{
  $temp = isset($_REQUEST['user_type']) ? $_REQUEST['user_type'] : '';
  if ($temp) {
    WC()->session->set('user_type', $temp);
  }
  die();
}
add_action('wp_ajax_set_user_type', 'set_user_type_func');
add_action('wp_ajax_nopriv_set_user_type', 'set_user_type_func');

However, the value in the session does not change.
At the same time, the correct values ​​are passed to the $temp variable.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question