Hi,
I’m not sure if I’m going to be able to help you as I think I couldn’t fully understand your situation but this could be at least a suggestion.
1- Add our alg_wc_ev_is_activated
meta to the REST API.
Pay attention to the auth_callback
parameter. Here I’m simply testing if the current logged user is the same user being updated, but you may want a different test.
add_action( 'rest_api_init', function(){
register_meta( 'user', 'alg_wc_ev_is_activated', [
'type' => 'boolean',
'single' => true,
'show_in_rest' => true,
'auth_callback' => function ( $valid, $meta, $user_id ) {
return get_current_user_id() === $user_id;
}
] );
} );
2- Update the user meta
Use the /wp-json/wp/v2/users/$user_id/
to update the alg_wc_ev_is_activated
meta.