Is there a way I can hook into the product attributes drop-down filter widget and save the chosen value into the user meta? I basically want to know what the user's last used filter was so I can default it later on.
Something like this maybe?
function save_attribute_filter_in_user_meta($selectedValue){
if(is_user_logged_in()){
$curr_user_id = get_current_user_id();
// save/overwrite selected product attribute filter value into user meta
update_user_meta( $curr_user_id, 'currentSelectedFilter', $selectedValue);
}
}
add_action('whatever_this_hook_is', 'save_attribute_filter_in_user_meta');
If there is no way of hooking into it, any idea how I could accomplish this?