The legislation will now head to the Senate for passage before it can be signed by President Donald Trump.