$wp_session = WP_Session::get_instance();
is method to create your own session in woocommerce/wordpress.
You can use $wp_session['session_name'] on any file in woocommerce/wordpress
after creating but if you want to change its value you need to first convert this object to array.
For creating array use
$temp = current((array)$wp_session['session_name']);
$temp return you the array / value assigned to $wp_session['session_name']...
Now use or edit $temp as your need and after use assign this array again to $wp_session['session_name']
using
unset ($wp_session['session_name']);
$wp_session['session_name']=$temp;
Example :
$wp_session = WP_Session::get_instance();
$temp = current((array)$wp_session['session_name']);
/***
Work with the array
***/
unset ($wp_session['session_name']);
$wp_session['session_name']=$temp;
is method to create your own session in woocommerce/wordpress.
You can use $wp_session['session_name'] on any file in woocommerce/wordpress
after creating but if you want to change its value you need to first convert this object to array.
For creating array use
$temp = current((array)$wp_session['session_name']);
$temp return you the array / value assigned to $wp_session['session_name']...
Now use or edit $temp as your need and after use assign this array again to $wp_session['session_name']
using
unset ($wp_session['session_name']);
$wp_session['session_name']=$temp;
Example :
$wp_session = WP_Session::get_instance();
$temp = current((array)$wp_session['session_name']);
/***
Work with the array
***/
unset ($wp_session['session_name']);
$wp_session['session_name']=$temp;
No comments:
Post a Comment