I fixed the error by restoring the WooCommerce database tables. During the migration, I accidentally deleted tables that stored user session information. After that, all I had to do was go to WooCommerce in the WordPress dashboard -> Status -> Tools -> Verify the base database tables.