This was challenged as being in violation of the Acts of Union 1800 (particularly Article 6, which establishes an all-UK Customs Union) but the High Court ruled that the relevant parts of the Acts of Union are "impliedly repealed" by the Withdrawal Agreement Act.
There's a BBC article covering this here: https://www.bbc.com/news/uk-northern-ireland-57666255