Wa alaykum salam wa rahmatuLlahi wa barakatuHu,
Firstly, Ibn Hazm’s opinions on ijma’ are sourced frequently by the Murajjihun in our School. In Majmu’, Imam Nawawi cites from his works.
Regarding what Ibn Hazm said, a similar text is also related by Ibn al-Qattan al-Fasi. (Iqna’ 2/299) In Maratib al-Ijma’ p. 157, Ibn Hazm says,
اتفقوا أن حلق جميع اللحية مثلة لا تجوز
In Arabic, the word -if vowelized “mathulah”- means as a punishment. If this be the case, then what Ibn Hazm related is specific due to this added qualification. Even in the way Ibn Hazm worded it, the verb “la tajuzu” is feminine indicating that the reference would be on the point of “mathulah.”
In the discussions of ta’zir, the Shafi’i scholars stated that it is not permissible to shave off a person’s beard. This is mentioned by Shaykh al-Islam. (Sharh al-Rawd 4/162)
And Allah knows best.
Answered by Shaykh Yaqub Abdurrahman