Conditional output based on taxonomy ID of custom post

Change operator to:

 if($term->term_id === 4 ):

Check this for more: https://stackoverflow.com/a/80649/12785113