8

Both M1 and M2 don't allow hyphens or dashes in its store codes. There is backend validation against it. However, it is not clear why. Any idea?

1
  • 1
    Maybe the dev just did not know how to make the regex :) Truly, I do not know but I am curious as it is a request I often have. Commented Nov 8, 2017 at 11:51

1 Answer 1

2
+50

The only explanation I can find is:

A code is an identifier and normally represents one word. Therefore it consist of characters of the word-character class. Also not starting with a number sounds like a named identifier. So your two-words use-case is not applicable on the code, as it represents one word. Therefore no non-word-characters are allowed.

So you've found you can use a single word within the path-component of the URI and you've found out that the store-code is not suitable for two words. An URL-rewrite and output filter can handle this.

Taken from Hakre's comment about Magento 1 but I suspect the same logic is added to Magento 2 -https://stackoverflow.com/questions/10353636/magento-dash-in-store-code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.