Conditional based on the User Role of the Current Profile the user is viewing – BuddyPress [closed]

I think you need to check if the displayed user has that role, try replacing $user->ID with bp_displayed_user_id():

function my_setup_nav() {   
   if ( user_can( bp_displayed_user_id(), 'store_owner' ) ) {
       // ... rest of your code
   }
}