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

Enable checkout-summary.compact block to show a total value based on visible totalizers #38

Merged
merged 6 commits into from
Nov 16, 2020

Conversation

victorhmp
Copy link
Contributor

@victorhmp victorhmp commented Oct 13, 2020

What problem is this solving?

Currently, the value received by the totalizersToShow prop is only taken into account to toggle the visibility of each totalizer, but doesn't have any effect in the Total value shown in the minicart.v2. This can create weird behaviors, such as this one:

image

In this image, the Total is greater than Subtotal because it takes into account the Shipping price. But since Shipping is not in being shown to users, it might be confusing.

To avoid this, we're adding a new totalCalculation prop, that enables users to control whether or not the checkout-summary.compact should only take into account the visible totalizers to calculate the Total displayed to users.

Also, we'll refrain from showing the Shipping and taxes calculated at checkout. disclaimer if the Shipping totalizer is already taken into account to show the Total price.

How to test it?

  1. Go to the [master workspace](Link goes here!) and add the Top Wood Clock product to the cart. The minicart.v2 should pop open, and you should see this at the bottom:

Screen Shot 2020-10-14 at 14 34 26

Notice that the Total is greater than the Subtotal. That's because there's a shipping cost being added. The problem here is that the client doesn't know that, and the disclaimer at the bottom is misleading in this case since the shipping cost is already being considered.

  1. Go to this workspace and add the same product to the cart. Now you should see a summary that looks like this:

Screen Shot 2020-10-14 at 14 37 32

This is now the default behavior, and the shipping cost is not taken into account.

  1. Now go to this workspace and add the same item to the cart. You should see a summary that looks like this:

Screen Shot 2020-10-14 at 14 42 04

In this case, the checkout-summary.compact block is configured as:

"checkout-summary.compact#minicart": {
    "children": ["summary-totalizers#minicart"],
    "props": {
      "totalizersToShow": ["Items", "Discounts", "Shipping"]
    }
  },

How does this PR make you feel? 🔗

Add a new prop to control how the total shown by the SummarySmall component is calculated.

This enables the component to show total values calculated based only on visible totalizers.
@victorhmp victorhmp self-assigned this Oct 13, 2020
@vtex-io-ci-cd
Copy link

vtex-io-ci-cd bot commented Oct 13, 2020

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 😞

@vtex-io-docs-bot
Copy link

vtex-io-docs-bot bot commented Oct 13, 2020

Beep boop 🤖

I noticed you didn't make any changes at the docs/ folder

  • There's nothing new to document 🤔
  • I'll do it later 😞

In order to keep track, I'll create an issue if you decide now is not a good time

  • I just updated 🎉🎉

@victorhmp victorhmp marked this pull request as ready for review October 14, 2020 17:53
@victorhmp victorhmp requested review from a team as code owners October 14, 2020 17:53
@vitorflg
Copy link

It looks like that the link of the second workspace is not working =/

@victorhmp
Copy link
Contributor Author

It looks like that the link of the second workspace is not working =/

Updated it! Sorry about that 😅

@victorhmp victorhmp requested review from klzns, icazevedo and guerreirobeatriz and removed request for carolinamenezes October 16, 2020 17:00
docs/README.md Outdated Show resolved Hide resolved
docs/README.md Outdated Show resolved Hide resolved
@victorhmp victorhmp merged commit 7f58a0a into master Nov 16, 2020
@victorhmp victorhmp deleted the feature/improved-totalizers-logic-in-summarySmall branch November 16, 2020 19:05
@vtex-io-ci-cd
Copy link

vtex-io-ci-cd bot commented Nov 16, 2020

Your PR has been merged! App is being published. 🚀
Version 0.16.0 → 0.17.0

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 vtex.checkout-summary@0.17.0

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.

7 participants