-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix add to cart behavior when initiallyOpened prop is 'always' #116
Conversation
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
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.
Hey @polishq. I'm receiving page not found
at the link provided for tests.
@danzanzini Here's a working product link with a subscription attachment: https://pdp2--beautycounterqa.myvtex.com/all-bright-bundle/p?__bindingAddress=www.beautycounterqa.com/en-us |
Thanks, @polishq! I've tested and noticed two things:
I'm not sure if this should be fixed here or at another place. Let me know :) |
|
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.
It's approved now, @polishq. Sorry about the waiting time :)
Your PR has been merged! App is being published. 🚀 After the publishing process has been completed (check #vtex-io-releases) and doing A/B tests with the new version, you can deploy your release by running:
After that your app will be updated on all accounts. For more information on the deployment process check the docs. 📖 |
What problem is this solving?
As described in this issue: #74
When the
initiallyOpened
prop is set toalways
, the component simply doesn't work. Assembly options can be selected on the PDP, but they are ignored when adding to cart. I traced this down to an issue with theoptin
value in the component state. Ifoptin
is false, the ProductContext is not updated with the user's assembly option selections. And if theinitiallyOpened
prop is set toalways
, there was nothing settingoptin
totrue
(because this was done when the user clicked on the button to open the interface).This PR fixes the issue by checking the value of the
initiallyOpened
prop when initializing the component state. IfinitiallyOpened
is set toalways
,optin
will be initialized astrue
instead offalse
.How to test it?
Linked here: https://pdp2--beautycounterqa.myvtex.com/counter-all-bright-c-serum-100000750/p?__bindingAddress=www.beautycounterqa.com/en-us
(The
initiallyOpened
prop is set toalways
in this workspace.)