$product->ID in has_term() not working, but manually inputting the ID works, why?

$product->ID in has_term() not working, but manually inputting the ID works, why?

error code: 523