-
Notifications
You must be signed in to change notification settings - Fork 153
Add query to get available stores #390
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
Add query to get available stores #390
Conversation
Agree with you on this one - I don't think it makes much sense for |
### Proposed schema | ||
```graphql | ||
type Query { | ||
availableStores: [StoreConfig] @doc(description: "Get a list of available stores") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to name this something like availableStoreViews
? For UI developers in a headless world, the GraphQL schema will often be their first introduction to some Magento concepts.
Referencing "store view" instead of just "store" will make it much easier to Google for the right concept (test googling magento stores
vs magento store views
)
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Often times in the frontend we refer to store views as stores interchangeably. I think using just "store" is more consistent; e.g. StoreConfig and the Store header we use for store code. it's a good point. maybe just changing the description will be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just changing the description will be enough?
The one downside there is that most tools like GraphiQL don't cover the description
in their search field, so searching for something like store view
wouldn't net any results.
BUT, you do raise a good point re: consistency vs accuracy. My feelings here aren't too strong, so I'll leave this as a judgement call for you to make 👍
Had one question re: naming, but from a technical perspective this looks good to me 👍 |
We need to make sure that the list of websites is not exposed by default. Currently some merchants want to hide the fact that they are managing multiple websites, and it is controlled using setting in the admin panel. |
@paliarush This query will only expose other store views, under the same website as the current store (by Store code passed in header). So the list of websites would not be exposed. |
@paliarush any more changes you want to see here? |
Problem
No way to get available stores. This is needed for something like a store switcher.
See issue: magento/magento2#28569
Solution
Introduce new query for fetching available stores. Based on the current store, it will return a list of StoreConfigs for other stores available under the same website.
Alternate solution:
In the linked issue it is suggested to return a new field "stores" under current storeConfig, with list of available stores. To me this seems a little confusing because the available stores is not part of the current store's configuration. However I mention that approach in case it is preferred.
Requested Reviewers
@paliarush
@DrewML