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

Fix add to cart behavior when initiallyOpened prop is 'always' #116

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

polishq
Copy link
Contributor

@polishq polishq commented Nov 22, 2022

What problem is this solving?

As described in this issue: #74
When the initiallyOpened prop is set to always, 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 the optin value in the component state. If optin is false, the ProductContext is not updated with the user's assembly option selections. And if the initiallyOpened prop is set to always, there was nothing setting optin to true (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. If initiallyOpened is set to always, optin will be initialized as true instead of false.

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 to always in this workspace.)

@polishq polishq requested a review from a team as a code owner November 22, 2022 22:31
@vtex-io-ci-cd
Copy link

vtex-io-ci-cd bot commented Nov 22, 2022

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:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

Copy link

@danzanzini danzanzini left a 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.

@polishq
Copy link
Contributor Author

polishq commented Dec 6, 2022

@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

@danzanzini
Copy link

Thanks, @polishq!

I've tested and noticed two things:

  1. I've added the product twice with different subscription options. The cart doesn't show what's the subscription for each item:

Screen Shot 2022-12-06 at 11 42 32 AM

  1. At the checkout page, the key is not being translated:

Screen Shot 2022-12-06 at 11 42 11 AM

I'm not sure if this should be fixed here or at another place. Let me know :)

@polishq
Copy link
Contributor Author

polishq commented Dec 6, 2022

@danzanzini

  1. I'm not aware that there's any block to display attachments in the minicart, but in any case I don't think this app would be the one responsible to provide this block.
  2. This is probably due to checkout customization, again not related to this app.

Copy link

@danzanzini danzanzini left a 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 :)

@polishq polishq merged commit d8ae95b into master Dec 12, 2022
@polishq polishq deleted the fix/optin branch December 12, 2022 14:08
@vtex-io-ci-cd
Copy link

vtex-io-ci-cd bot commented Dec 12, 2022

Your PR has been merged! App is being published. 🚀
Version 2.11.3 → 2.11.4

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:

vtex deploy [email protected]

After that your app will be updated on all accounts.

For more information on the deployment process check the docs. 📖

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

Successfully merging this pull request may close these issues.

2 participants