Probably a typo since you excluded all commercial shipments in the first paragraph
Be honest: if they did this (target these US and Israeli commercial shipments you mentioned) would you then say they're not allowed to target commercial shipments but only military?
Disclaimer: the economic reverberations are catastrophic. The Iranian regime is catastrophic. But the Israeli and US regimes are no less so, for different reasons. Reasons that have become more and more apparent over the years. This regime argument is not only passe but hypocritical as well. A genocidal government cannot give out morality lessons to anyone.
Let me be more clear
Legally, Iran has no right to target mechant ships of other countries and mine Hormuz. These are civilian infrastructure of different countries not even responsible for the war with civilians on board passing through international navigation route.
During war, two priciples are followed
1) Distinction and Proportionality - Country must differentiate between military and civilian infrastructure. Civilian harms cannot be in excess and has to be avoided or minimised at all costs.
2) Necessity - attack must serve a military purpose.
Iran can only justify targetting merchant ships of other countries if these merchant ships are contributing to US and Israel military efforts which they aren't. Thus, it's unlawful and Iran has no right or justification for this.
Now, Iran do have right to self defense. It can target military infrastructure of US and Israel as counter response. It can also target merchant ships of US and Israel if they are contributing to their military efforts.
If these US merchant ships aren't contributing to military efforts then Iran has no right to target them as well.
However, we know realities of war are different.
During US and Israel strikes, civilian infrastructure of Iran did take damages. So, one can understand if Iran retaliated to target US and Israel merchant ships or threatened them to make them suffer economically.
But blocking entire Hormuz and not even allowing other countries shipments to pass is not right and justified by any means.