In all the sitecore 9 and above versions, this error happens when the sitecore instance is not able to find out the correct instance of commerce engine.
The storefront will get the configuration from ShopsService URL and communicate with the corresponding commerce engines.
Here are 2 steps you must check when this happens
- Go to showconfig.aspx and find the ShopsService and commerceOpsServiceUrl should point to https://localhost:5000. There might have been some override config files which is overwriting these values which you can find in showconfig url.
- Check to see if commerce engine metadata specified in shopsServiceUrl is accessable. For example shopsServiceUrl https://localhost:5000/CommerceOps/$metadata#Commands/$entity will need to be validated)