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

[FEATURE] Set Session CartContext via order token #704

Open
franzwilding opened this issue Mar 17, 2021 · 3 comments
Open

[FEATURE] Set Session CartContext via order token #704

franzwilding opened this issue Mar 17, 2021 · 3 comments

Comments

@franzwilding
Copy link

Hey!
I'm evaluating different approaches to include Sylius as a complete-headless or semi-headless e-commerce platform into our technology stack. The "semi-headless" approach would use some of the bigger Sylius SF/Twig frontend modules like the checkout, login, profile etc. while the integration into websites will be done via the API.

One of the user flows works like this:

  1. User creates a new cart and gets it's unique token value
  2. User adds items to this cart by using the token value
  3. User will be redirected to the Sylius checkout page

Is there an already existing way to pass a token value to a special route to set it as the default cart in the user session? I think it would be very easy to create such a controller and set the cart into the cart storage, however I was wondering if there already exists such a functionality and if others would like to have this.

@mamazu
Copy link
Member

mamazu commented Mar 18, 2021

Hello,
if you want to checkout with a predefined token in the ShopBundle, then there is no way in the standard Sylius. In general there is no way to migrate between the Shop UI and API. It is recommended to not use them together. So if you want to you should build some custom logic.

@lchrusciel
Copy link
Member

Hey Frantz,

what you are describing is indeed possible with ShopAPI, but would require this custom controller. What you've described would be even easier for logged-in user, because of cart assignment. However I would recommend you to test out Unified API served together with the newest Sylius, as there are a few more things fixed already(like links in the emails that point out to twig-based website if it is enabled by default).

@franzwilding
Copy link
Author

Hey @mamazu and @lchrusciel, thank you both for your answers!
I will have a closer look into the new unified API.

@mamazu can you recommend a better approach to include a Sylius Cart and an add-to-cart-button into another website? I don't want to have a full headless shop frontend and I also don't want to include the CMS content into the Sylius frontend.

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

3 participants