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

StoreCode from Cookies #845

Open
aleksitto-gh opened this issue Mar 1, 2022 · 3 comments
Open

StoreCode from Cookies #845

aleksitto-gh opened this issue Mar 1, 2022 · 3 comments

Comments

@aleksitto-gh
Copy link

User Story

As a user, I want to see products in the preferrable currency

Description & Motivation

Users shall be able to switch currency for the same page path. So that can give a correct overview of products in a preferable way.

Deliverables

MagentoGraphqlClientImpl class shall be extended to support special cookie param for determining store code.

Inside the initModel method check if the cookie param is there. If it is valid then use it otherwise go with the default steps (getCustomHttpHeaders or readFallBackConfiguration).

It shall be configurable in order to make it flexible and secure. MagentoGraphqlClientImpl configuration shall have the following parameters:

  • Allow store code definition via cookies (checkbox)
  • Store code cookie param name (default value "store")
  • Allowed store codes (an array of allowed store codes)

Acceptance Criteria

Store code can be changed via cookie parameter if it is defined in the MagentoGraphqlClientImpl configuration if it is enabled and defined in the list of allowed store codes.

@mhaack
Copy link
Contributor

mhaack commented Mar 15, 2022

This functionality is already possible today without cookie. The store code for GraphQL class is send via HTTP header, see https://devdocs.magento.com/guides/v2.4/graphql/send-request.html.

To use multiple stores with Magento and also allow users switching between them the typical AEM approach us to setup MSM site structures in AEM. See docs for details.

@aleksitto-gh
Copy link
Author

Hey!

We can not use the MSM approach exactly for this case because links for such pages are used around the world.

It's true that the StoreCode param is sent via header but MagentoGraphqlClientImpl returns an immutable map and the original list of params can not be changed. It can not be changed even via java reflection (probably because the class loader from our bundle is different).

@aleksitto-gh
Copy link
Author

Hey guys, any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants