Wa`alaykum as-salam wa rahmatullahi wa barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
1- The majority of scholars, with the exception of Hanbalis and Ibn Hazm, agree on that it is only recommended for the one who wants to offer a sacrifice to refrain from removing anything (hair or nails) when he or she sees the new moon of Dhul-Hijjah.
2- Additionally, even the Hanbalis, who say that it is obligatory, do not invalidate one’s sacrifice if he or she cuts his or her hair or nails. Thus, the sacrifice of those who cut their hair and/or trimmed their nails while not knowing that the moon of Dhul-Hijjah was seen is valid.
In his response to your question, Sheikh `Abdul-Majeed Subh, a prominent Azharite scholar, stated,
It was narrated from Umm Salamah (may Allah be pleased with her) that Prophet Muhammad (peace and blessings of Allah be upon him) said, “When you see the new moon of Dhul-Hijjah and one of you wants to offer a sacrifice, let him refrain from (removing anything) from his hair or nails.” (Muslim)
Refraining from cutting the hair and trimming the nails is a sunnah, but it does not invalidate the sacrifice in anyway, even if the person knew that he was doing this after the beginning of Dhul-Hijjah.
Once the person learns about the beginning of Dhul-Hijjah, he or she is advised to refrain from cutting hair and trimming nails, and there is neither fear nor doubt for the validity of the sacrifice and he or she will get the reward of following the sunnah.
Moreover, Sheikh `Abdel Khaliq Hassan Ash-Shareef, an Egypt-based renowned scholar and da`iyah, added,
There is no impact of what they did on the validity of their sacrifice. It is only recommended not to cut the hair or trim the nails in the first 10 days of Dhul-Hijjah for one who intends to offer a sacrifice. However, if the person cuts his or her hair or trimmed his or her nails, it is not considered to be a sin and there is nothing wrong with his or her sacrifice.
Almighty Allah knows best.