Consent to the use of Personal Data and Cookies

This website needs your consent to use cookies in order to customize ads and content.

If you give us your consent, data may be shared with Google.

Shopware: Unable to find a matching sales channel

How to fix an error in Shopware that prevents displaying the frontpage: Unable to find a matching sales channel

10 views
d

By. Jacob

Edited: 2022-05-23 12:05

When working with Shopware, you may come across an Unable to find a matching sales channel error message, which may generate a SalesChannelMappingException; in my experience, this happens when there is no URL or HOST configured in the sales channel, resulting in errors on the frontpage.

On the frontpage this error might show up as 500 Internal Server Error with no further explanation, but you might be able to get the real cause of the error in the server log files, located in /var/www/my-shopware-site/var/log/ (depending on install location, of course).

Shopware 500 Internal Server error

The 500 Internal Server Error message is just a generic error message, and does not help to tell you what went wrong; you will need to read the log files for that.

Note. While there will be errors on the frontpage, you should still be able to access the /admin URL.

If you can access /admin, then you will probably be able to fix it by entering example.com/admin in your browsers address field, and then adding the website URL to the main sales channel. E.g.: http://localhost

In my case, this situation happened when I was trying to setup a local development environment in Docker.

Another way you may be able to fix it would be by changing the relevant database table rows, but I recommend just adding a new sales channel for your http://localhost.

Remember to reload the frontpage in an Incognito Window to test your site afterwards, because there might be some caching issues preventing the page from reloading properly.

Port number for localhost

If you are running a local environment on a different port number than standard port 80, then you should put this in the URL as well. E.g.: http://localhost:8000.

When in the /admin UI for the main sales channel, you may not be able to type the port number; I had some issues with that, but somehow I was able to type the number anyway, I think, by putting colon (:) in between host and port after typing the port. You may also be able to simply copy/paste the correct address. The problem seems to be, the input field does not expect port numbers for some reason.

In the end I decided to just run on port 80, because I do not know if there is a reason why the port number is difficult to enter in the sales channel. However, I did have it working on port 8000 for a while.

Fixing the database directly

If you wish to add a sales channel manually through the database, then you should be looking at the sales_channel_domain table – although it will probably be better to add the new sales channel through the /admin back-end or by using the bin/console script.

If trying to fix the database, you may be able to simply change the live server URL to that of your test-server. If it does not work you can just change it back again.

Of course, also remember to clear the cache on your site after adding the URL to the sales channel one way or another.

More information

  1. Custom Domains - dockware.io

Tell us what you think:

  1. When updating Shopware, AclPermissionCollection may no longer exist, resulting in a clogged enqueue table and breaking the message workers.

More in: Shopware