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

Add money back mention in checkout page #54169

Merged
merged 10 commits into from
Jul 29, 2021

Conversation

monsieur-z
Copy link
Contributor

@monsieur-z monsieur-z commented Jun 30, 2021

Changes proposed in this Pull Request

This PR adds a money back guarantee mention in the footer of the checkout page (for Jetpack products). It also centers the submit button on mobile.

Fixes 1196108640073826-as-1200480578254960

Testing instructions

Prerequisittes

  • Make sure you have a simple site and a Jetpack site available
  • Download the PR and run Calypso

Instructions

  • Visit the plans page with your simple site selected
  • Add a product to your cart
  • Check that you don't see the money back mention at the bottom of the page
  • Visit the plans page with your Jetpack site selected
  • Add a yearly plan to the cart
  • Check that the submit button of the checkout page is centered on mobile
  • Notice the 14 day money back mention at the bottom of the page
  • Check that on mobile (viewport width < 700px) the sticky footer doesn't hide the content of the page
  • Go back to the plans page and add a monthly product
  • Check that you see both the 14 day and 7 day mentions
  • Remove the yearly plan from the cart
  • Check that you see the 7 day money back mention

Screenshots

Money back mention

Before
Screen Shot 2021-06-30 at 9 08 16 AM

After (yearly products)
Screen Shot 2021-06-30 at 10 01 24 AM

After (monthly products)
Screen Shot 2021-07-07 at 10 37 33 AM

After (both yearly and monthly products)
Screen Shot 2021-07-07 at 10 37 55 AM

Submit button

Before
Screen Shot 2021-06-30 at 10 05 19 AM

After
Screen Shot 2021-06-30 at 10 05 06 AM

@monsieur-z monsieur-z added [Feature] Checkout The checkout screen and process for purchases made on WordPress.com. [Size] XS Tiny sized issue labels Jun 30, 2021
@monsieur-z monsieur-z requested review from a team June 30, 2021 14:35
@monsieur-z monsieur-z requested a review from a team as a code owner June 30, 2021 14:35
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 30, 2021
@matticbot
Copy link
Contributor

matticbot commented Jun 30, 2021

@matticbot
Copy link
Contributor

This PR modifies the release build for editing-toolkit

To test your changes on WordPress.com, run install-plugin.sh editing-toolkit improve/checkout-money-back-mention on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-mMA-p2

Copy link
Contributor

@mattgawarecki mattgawarecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub seems to be a little unhappy for some reason, but the errors it lists seem incorrect. I tested on calypso.live and everything looked exactly as described, and the code changes look reasonable to me. 👍

@sirbrillig
Copy link
Member

sirbrillig commented Jun 30, 2021

I think the compile errors you're seeing are because the composite-checkout npm package isn't set up to build with image imports (at least for TypeScript), so the build of that package is failing, which causes calypso (that requires that package) to fail as well.

submitButtonFooter={
<SubmitButtonFooter>
<img src={ badge14Src } alt="" />
<span>{ translate( '14 day money back guarantee' ) }</span>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 23 times:
translate( '7 day money back guarantee' ) ES Score: 8
See 2 additional suggestions in the PR translation status page

@matticbot
Copy link
Contributor

matticbot commented Jun 30, 2021

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~854 bytes added 📈 [gzipped])

name                   parsed_size           gzip_size
checkout                   +2777 B  (+0.2%)     +837 B  (+0.2%)
site-purchases              +791 B  (+0.1%)     +265 B  (+0.1%)
purchases                   +791 B  (+0.1%)     +265 B  (+0.1%)
plans                       +191 B  (+0.0%)      +17 B  (+0.0%)
jetpack-connect             +191 B  (+0.0%)      +17 B  (+0.0%)
jetpack-cloud-pricing       +191 B  (+0.1%)      +17 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~837 bytes added 📈 [gzipped])

name                                             parsed_size           gzip_size
async-load-calypso-blocks-editor-checkout-modal      +2777 B  (+0.3%)     +837 B  (+0.3%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@monsieur-z
Copy link
Contributor Author

I think the compile errors you're seeing are because the composite-checkout npm package isn't set up to build with image imports (at least for TypeScript), so the build of that package is failing, which causes calypso (that requires that package) to fail as well.

Moving the footer to client seemed to fix it.

submitButtonFooter={
<SubmitButtonFooter>
<img src={ badge14Src } alt="" />
<span>{ translate( '14 day money back guarantee' ) }</span>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll clarify if that's for a subset of products only.

@@ -472,11 +473,13 @@ export function CheckoutStepArea( {
children,
className,
submitButtonHeader,
submitButtonFooter,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition; could you add it to the README?

- `submitButtonHeader: React.ReactNode`. Displays with the Checkout submit button.

Copy link
Contributor

@keoshi keoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me!

The first thing that came to mind when I was testing it is that this badge is visible to all customers purchasing through Calypso independently of the platform/product they use.

I thought this wouldn't apply to dotcom for instance, but it seems like my assumption was wrong, so this gets the green light from my side but also pinging dotcom to give them the opportunity to weigh in.

@keoshi keoshi requested a review from a team July 1, 2021 13:54
@keoshi keoshi added the [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR label Jul 1, 2021
@github-actions github-actions bot added the [Status] Design Input Requested Label automatically added to PRs where design feedback is requested label Jul 1, 2021
@monsieur-z
Copy link
Contributor Author

The first thing that came to mind when I was testing it is that this badge is visible to all customers purchasing through Calypso independently of the platform/product they use.

Thanks @keoshi. We've limited the display of that mention to carts that only contain Jetpack products. We'll update the PR to make it 7 days for monthly products.

hasYearlyJetpackProductInCart && (
<SubmitButtonFooter>
<img src={ badge14Src } alt="" />
<span>{ translate( '14 day money back guarantee' ) }</span>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 23 times:
translate( '7 day money back guarantee' ) ES Score: 8
See 2 additional suggestions in the PR translation status page

Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now! I tested with a Jetpack site (where I see the icon) and on a non-Jetpack site (where I don't see the icon).

I updated the PR description slightly to clarify that this only changes the behavior for Jetpack products.

Worth noting that there is already a 14-day mention in the sidebar of checkout.

Newly added Jetpack product messaging:

Screen Shot 2021-07-05 at 3 45 43 PM

Existing messaging for both Jetpack and non-Jetpack products (in sidebar):

Screen Shot 2021-07-05 at 3 48 20 PM

@sirbrillig
Copy link
Member

sirbrillig commented Jul 5, 2021

If it's useful, here's the code for the existing money-back guarantee text, which is slightly differently constructed (it looks like it can sometimes be 4 days?):

let refundDays = 0;
if ( hasDomainsInCart && ! hasPlanInCart ) {
refundDays = 4;
} else if ( hasPlanInCart && ! hasDomainsInCart ) {
refundDays = hasMonthlyPlan ? 7 : 14;
}
if ( refundDays !== 0 ) {
// Using plural translation because some languages have multiple plural forms and no plural-agnostic.
refundText = translate(
'%(days)d-day money back guarantee',
'%(days)d-day money back guarantee',
{
count: refundDays,
args: { days: refundDays },
}
);
}

@monsieur-z monsieur-z added [Size] S Small sized issue and removed [Size] XS Tiny sized issue labels Jul 7, 2021
@monsieur-z
Copy link
Contributor Author

I've updated the behaviour and instructions according to the latest specs.

@monsieur-z monsieur-z requested a review from a team July 7, 2021 16:52
@monsieur-z monsieur-z force-pushed the improve/checkout-money-back-mention branch from 1b934d8 to 72da402 Compare July 26, 2021 19:46
@monsieur-z
Copy link
Contributor Author

Nice catch, @sirbrillig, thanks! I updated the code and instructions. When the footer is sticky, the bottom margin of its container matches its height so that there's enough room to display it without hiding the rest of the page. I also rebased the PR along the way.

@DavidRothstein
Copy link
Contributor

Worth noting (although I realize it's older, and not exactly the same thing): p8Eqe3-G9-p2

setSubmitWrapperHeight( submitWrapperRef.current.offsetHeight );
}
setInitialVw( window.innerWidth );
}, [ setSubmitWrapperHeight, submitWrapperRef, setInitialVw ] );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that submitWrapperRef should not be in the dependencies here since it's a Ref and it will never change. Otherwise it implies that the block will re-run when the Ref's value changes.

Based on my understanding of the code, I think that's fine since it looks like this useEffect may only be meant to trigger once, but if you think it needs to trigger when submitWrapperRef.current (or submitWrapperRef.current.offsetHeight) changes, you can make that a dependency instead (although due to the nature of TypeScript you'll need to assign it to a temporary variable first, like maybe const submitWrapperHeight = submitWrapper.current?.offsetHeight and then make submitWrapperHeight the dependency).

@matticbot
Copy link
Contributor

This PR modifies the release build for notifications

To test your changes on WordPress.com, run install-plugin.sh notifications improve/checkout-money-back-mention on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-elI-p2

@matticbot
Copy link
Contributor

This PR modifies the release build for wpcom-block-editor

To test your changes on WordPress.com, run install-plugin.sh wpcom-block-editor improve/checkout-money-back-mention on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-l4k-p2

@sirbrillig
Copy link
Member

Thanks for adding that code! A very clever solution. When I load checkout now using a small viewport, the Total is visible!

Screen Shot 2021-07-27 at 10 29 48 AM

The only downside I can see, and this is much less important, is that the solution is not responsive. If I resize my window to be smaller, then the amount of spacing for the footer remains constant. Here's what it looks like if I resize a larger viewport to a smaller one.

Screen Shot 2021-07-27 at 10 29 15 AM

In practice I'm sure this doesn't happen often at all, so we could probably ignore it, but it does bother me especially since the functionality that manages that spacing is outside of calypso in a soon-to-be published npm package. 🤔 What if we registered a resize event handler and used it to recalculate the viewport size? If you think that would be a lot more code, I don't want to unnecessarily bloat this PR so it could be a separate change if you like.

Another thing I noticed, that might also be low priority, is that the help button now overlaps the refund text at small widths.

overlapping-help-button

I think I remember some effort that had gone into making it not overlap text previously on mobile, leading to its current position, but it's tricky to manage floating elements like that. What do you think?

@monsieur-z
Copy link
Contributor Author

it does bother me especially since the functionality that manages that spacing is outside of calypso in a soon-to-be published npm package.

You're right @sirbrillig, especially since the code changes are pretty straightforward.

Another thing I noticed, that might also be low priority, is that the help button now overlaps the refund text at small widths.

Good catch! I added some padding that should prevent that for the moment. I believe this whole addition will go through another round of design at some point.

@matticbot
Copy link
Contributor

This PR modifies the release build for o2-blocks

To test your changes on WordPress.com, run install-plugin.sh o2-blocks improve/checkout-money-back-mention on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-r7r-p2

Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely. Thank you for the additions!

@monsieur-z monsieur-z merged commit 099686e into trunk Jul 29, 2021
@monsieur-z monsieur-z deleted the improve/checkout-money-back-mention branch July 29, 2021 15:28
@github-actions github-actions bot removed [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Design Input Requested Label automatically added to PRs where design feedback is requested [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jul 29, 2021
@a8ci18n
Copy link

a8ci18n commented Jul 29, 2021

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/6301029

Thank you @monsieur-z for including a screenshot in the description! This is really helpful for our translators.

@a8ci18n
Copy link

a8ci18n commented Aug 5, 2021

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Checkout The checkout screen and process for purchases made on WordPress.com. [Size] S Small sized issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants