Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the purpose of "devStorefrontUrl"? #1643

Open
AlexBa opened this issue Jan 25, 2025 · 2 comments
Open

What is the purpose of "devStorefrontUrl"? #1643

AlexBa opened this issue Jan 25, 2025 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@AlexBa
Copy link

AlexBa commented Jan 25, 2025

I have searched for more infos about "devStorefrontUrl", but haven't found anything more detailed about it.

Does anyone know what it does exactly? A concrete example or documentation would probably be helpful.

@AlexBa AlexBa added the documentation Improvements or additions to documentation label Jan 25, 2025
@patzick
Copy link
Collaborator

patzick commented Jan 27, 2025

hey @AlexBa
you're absolutely right! The only mention that I found is here: https://frontends.shopware.com/resources/troubleshooting.html#_412-error-page-during-local-development

we'll add the description!

@mkucmus
Copy link
Collaborator

mkucmus commented Jan 27, 2025

guilty! :)
we better add some docs about it, but the question requires an answer beforehand:

the devStorefrontUrl is a helper that is being used mainly or only for customer registration purposes:

storefrontUrl: getStorefrontUrl(),

the user register endpoint requires storefrontUrl parameter in the payload that will tell the backend what domain the customer is connected to (like sales channel is not enough and also can be different domain for different language and currency - see domains options in sales channel config).

normally we could use window.location.origin but it doesn't really work well for local development or when API is hosted somewhere else which is a common practice, so here's the condition:

return devStorefrontUrl ?? window.location.origin ?? "";

so this is the place where the logic takes off and the devStorefrontUrl is used for the first time.


the docs will be updated, thanks for pointing the missing docs about this 🥇

@mkucmus mkucmus moved this from No status to Developer Backlog in Composable Frontends Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: Developer Backlog
Development

No branches or pull requests

3 participants