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

Does add to cart via Clerk content blocks work #91

Open
JamesFX2 opened this issue Jan 24, 2023 · 3 comments
Open

Does add to cart via Clerk content blocks work #91

JamesFX2 opened this issue Jan 24, 2023 · 3 comments

Comments

@JamesFX2
Copy link

With reference to https://github.com/clerkio/clerk-magento2/blob/master/view/frontend/templates/tracking.phtml#L23-L26

Marketing guy asked about adding items to cart via Clerk blocks and I noticed the above. The basics of add to cart in M2 are formKey and a base64 encoded URL, like you've done above. Awesome.

But unlike you've done, the form_key on a page cached site comes from a cookie, not from the form key at time of cache, with Magento_PageCache/js/form-key-provider updating all 'input[name="form_key"] elements to use this value.

So in my head, using the globals formkey generated in tracking.phtml won't work, it will give an invalid form key.

@JamesFX2
Copy link
Author

If not check if page cache is enabled, if so read the cookie and use that as the formkey value.

@stubbedev
Copy link
Contributor

I think the suggestion you made, for checking the cache settings is a good approach. I will see what I can do in this regard in the coming days.

Thanks for bringing the issue to my attention.

@janssensjelle
Copy link

Is there any progress in this? :-)

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