Thanks that helped!
Do you have a similar hook to when product is removed from wishlist?
I still got some problems i want to add a value to a product attribute when it is added to wishlist for certain user roles..
I got this code:
add_action('yith_wcwl_added_to_wishlist', 'addOwnedByUserToProduct', 10, 3);
function addOwnedByUserToProduct($product_id, $wishlist_id, $user_id) {
if(!is_user_logged_in()) {
return;
}
$user = wp_get_current_user();
$roles = ( array ) $user->roles;
foreach ($roles as $role) {
if($role == 'medlem' || $role == 'administrator' || $role == 'bestyrelse') {
// add username as value to product attribute named "i eje" not really sure how to
break;
}
}
}
But i cant figure out how to add/append a value to the product attribute “i eje”..
I know it is not your problem but thanks for the help with the hook.. ??