I had the same issue. After 8 hours of research I fixed it. Please see below:
I am not affiliated with any of these link or programs, anything you do is at your own risk. However, this worked for me.
Fix issues with Microsoft Store
Step 1: Download the gaming Service Repair Tool for PC, from Xbox. https://aka.ms/GamingRepairTool
Follow instructions from here: https://support.xbox.com/en-US/help/games-apps/troubleshooting/gaming-services-repair-tool
Test if xbox works skip to Step 5.
If not, next
Step 2:
Download Wingetui from : https://www.marticliment.com/wingetui/ Install Go to the "Installed" tab and search "xbox". If you see "Xbox" Next, if not, Step 3
Right click on "xbox" and uninstall as administrator. Repeat for "Microsoft Store"
Step 3:
Goto: https://store.rg-adguard.net/
Copy link below and past in the space next to URL(link) https://apps.microsoft.com/detail/9MV0B5HZVK9Z?hl
Press the check mark or press enter
Step 4:
Right click on the windows icon on taskbar and click on Windows Powershell (admin)
Get the path to the downloaded file
Copy Add-AppxPackage -Path and paste in PowerShell, then add in the direct path to the file (see below for example)
Enter: Add-AppxPackage -Path C:\Path\App-Package.msixbundle
Step 5: run xbox app. This will find the error with windows store and fix it. Fix all issues found here. The locations to repair files in xbox app is settings -> General ENJOY