Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Allow shoppers to sign-up for an account from the Checkout block #3331

Merged
merged 5 commits into from
Oct 28, 2020

Conversation

haszari
Copy link
Member

@haszari haszari commented Oct 28, 2020

Fixes #3286

This PR removes the isExperimental feature flag for the checkout signup feature, so it can be launched to stores using WooCommerce Blocks feature plugin. 🎉

The feature gating is implemented as follows:

  • The Checkout block is currently feature gated to feature plugin only.
    • The Checkout block editor option allowCreateAccount is only displayed if store is running WooCommerce 4.7 or newer.
  • The service class implements back-end parts of the flow - creating the account, new account email, and a set password flow.
    • All functionality in this class is gated to feature plugin only AND WooCommerce 4.7 or newer.
  • The Checkout API also will only invoke create account if store is running WooCommerce 4.7 or newer.

To summarise:

If a store is running WooCommerce Blocks plugin, and WooCommerce 4.7 or newer, all features will be available:

  • Merchant can allow customers to sign up at checkout (block setting).
  • Checkout API will create accounts when requested.
  • New accounts created via checkout block will use the improved new-account email and set password flow.
    • Note: new accounts via other means will continue to use existing email & flow.

If the store is running an older version of WooCommerce, or the blocks plugin is not active, then no features should be available:

  • No block option to allow signups.
  • Checkout API should ignore any request to create account.
  • Existing core new-account email & password handling.

Screenshots

See related previous PRs for details of what's changed and how the feature works.

#2851

#3236

woocommerce/woocommerce#27898

How to test the changes in this Pull Request:

  • Test using a release build of the plugin. Previously this feature was only available in dev builds.
  • Confirm that feature is still working correctly in dev build.
  • Confirm that checkout signup is available and works correctly with blocks plugin + woo 4.7+.
  • Confirm that checkout signup is not available and doesn't cause any issues with woo version older than 4.7.0.

Note: When we next update the package included in WooCommerce Core, we'll need to confirm that checkout signup is not available (unless recent blocks plugin is active).

Changelog

Feature: Allow shoppers to sign-up for an account from the Checkout block. #2851 #3236 #3331

- remove isExperimental from block/editor js (the block is already gated
  to plugin only)
- gate entire service class to feature plugin && Woo >= 4.7
  - this ensures our custom email and set password flow are only active
    for supported woo version, if blocks plugin is active
  - also refactored the gating logic so the woo version check is used to
    gate all code
@haszari haszari requested a review from a team as a code owner October 28, 2020 02:15
@haszari haszari requested review from Aljullu and nerrad and removed request for a team October 28, 2020 02:15
@haszari haszari self-assigned this Oct 28, 2020
@haszari haszari added status: needs review block: checkout Issues related to the checkout block. labels Oct 28, 2020
@haszari haszari added this to the 3.7.0 milestone Oct 28, 2020
const showCreateAccountOption =
isExperimentalBuild() && compareWithWooVersion( '4.7.0', '<=' );
// Also implicitly gated to feature plugin, because Checkout
// block is gated to plugin
Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted a full stop on this comment, but eslint action told me to remove it cc4f7ed!

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if the lint rule got confused by the Checkout sentence case at the end of the line. Might be a bug in the rule.

@haszari haszari changed the title expose checkout signup feature to release build in feature plugin Allow shoppers to sign-up for an account from the Checkout block (WooCommerce Blocks plugin only) Oct 28, 2020
Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

I think we need to remove isExperimentalBuild() from these lines:

https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/assets/js/blocks/cart-checkout/checkout/form/contact-fields-step.js#L34
https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/assets/js/blocks/cart-checkout/checkout/block.js#L93

Another detail (not blocking): I saw AddressStep doesn't have allowCreateAccount in the propTypes, it would be nice to add it to ensure it's always a bool.

Besides that, everything was working and testing fine on my end, so pre-approving. 👍

Feature: Allow shoppers to sign-up for an account from the Checkout block (WooCommerce Blocks plugin only).

Do we need to state that it's a WC Blocks plugin only feature? Currently the Checkout block is also only available in the feature plugin so it sounds redundant.

- "Create Account?" checkbox in address/contact component
- logged-out prompt logic - handle case when signup is enabled and guest
checkout is not enabled, i.e. checkout requires automatic signup
@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2020

Size Change: -129 B (0%)

Total Size: 1.12 MB

Filename Size Change
build/active-filters-frontend.js 8.88 kB -15 B (0%)
build/all-products-frontend.js 31.2 kB -14 B (0%)
build/attribute-filter-frontend.js 18.3 kB -12 B (0%)
build/cart-frontend.js 70.1 kB -13 B (0%)
build/checkout-frontend.js 86 kB -32 B (0%)
build/checkout.js 42.1 kB -5 B (0%)
build/price-filter-frontend.js 14.9 kB -12 B (0%)
build/reviews-frontend.js 9.37 kB -12 B (0%)
build/single-product-frontend.js 33.8 kB -14 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/active-filters.js 8.94 kB 0 B
build/all-products.js 36.1 kB 0 B
build/all-reviews.js 9.78 kB 0 B
build/atomic-block-components/add-to-cart-frontend.js 8.94 kB 0 B
build/atomic-block-components/add-to-cart.js 7.52 kB 0 B
build/atomic-block-components/add-to-cart~atomic-block-components/button.js 3.19 kB 0 B
build/atomic-block-components/add-to-cart~atomic-block-components/image~atomic-block-components/title.js 335 B 0 B
build/atomic-block-components/button-frontend.js 2.02 kB 0 B
build/atomic-block-components/button.js 840 B 0 B
build/atomic-block-components/category-list-frontend.js 469 B 0 B
build/atomic-block-components/category-list.js 478 B 0 B
build/atomic-block-components/image-frontend.js 1.7 kB 0 B
build/atomic-block-components/image.js 1.15 kB 0 B
build/atomic-block-components/price-frontend.js 2.29 kB 0 B
build/atomic-block-components/price.js 2.32 kB 0 B
build/atomic-block-components/rating-frontend.js 524 B 0 B
build/atomic-block-components/rating.js 526 B 0 B
build/atomic-block-components/sale-badge-frontend.js 857 B 0 B
build/atomic-block-components/sale-badge.js 863 B 0 B
build/atomic-block-components/sku-frontend.js 386 B 0 B
build/atomic-block-components/sku.js 395 B 0 B
build/atomic-block-components/stock-indicator-frontend.js 568 B 0 B
build/atomic-block-components/stock-indicator.js 573 B 0 B
build/atomic-block-components/summary-frontend.js 917 B 0 B
build/atomic-block-components/summary.js 927 B 0 B
build/atomic-block-components/tag-list-frontend.js 467 B 0 B
build/atomic-block-components/tag-list.js 474 B 0 B
build/atomic-block-components/title-frontend.js 1.23 kB 0 B
build/atomic-block-components/title.js 1.06 kB 0 B
build/attribute-filter.js 12.5 kB 0 B
build/blocks.js 3.54 kB 0 B
build/cart.js 38.8 kB 0 B
build/editor-rtl.css 13.8 kB 0 B
build/editor.css 13.9 kB 0 B
build/featured-category.js 7.73 kB 0 B
build/featured-product.js 9.97 kB 0 B
build/handpicked-products.js 7.37 kB 0 B
build/price-filter.js 10.4 kB 0 B
build/product-best-sellers.js 7.45 kB 0 B
build/product-categories.js 3.23 kB 0 B
build/product-category.js 8.38 kB 0 B
build/product-new.js 7.61 kB 0 B
build/product-on-sale.js 8 kB 0 B
build/product-search.js 3.56 kB 0 B
build/product-tag.js 6.53 kB 0 B
build/product-top-rated.js 7.58 kB 0 B
build/products-by-attribute.js 8.35 kB 0 B
build/reviews-by-category.js 11.8 kB 0 B
build/reviews-by-product.js 13.4 kB 0 B
build/single-product.js 10.1 kB 0 B
build/style-rtl.css 17.9 kB 0 B
build/style.css 17.9 kB 0 B
build/vendors-style-rtl.css 1.03 kB 0 B
build/vendors-style.css 1.03 kB 0 B
build/vendors.js 417 kB 0 B
build/vendors~atomic-block-components/price-frontend.js 5.65 kB 0 B
build/wc-blocks-data.js 7.1 kB 0 B
build/wc-blocks-middleware.js 931 B 0 B
build/wc-blocks-registry.js 2.32 kB 0 B
build/wc-payment-method-bacs.js 790 B 0 B
build/wc-payment-method-cheque.js 787 B 0 B
build/wc-payment-method-cod.js 879 B 0 B
build/wc-payment-method-paypal.js 831 B 0 B
build/wc-payment-method-stripe.js 12 kB 0 B
build/wc-settings.js 2.35 kB 0 B
build/wc-shared-context.js 1.53 kB 0 B
build/wc-shared-hocs.js 1.66 kB 0 B

compressed-size-action

@haszari haszari changed the title Allow shoppers to sign-up for an account from the Checkout block (WooCommerce Blocks plugin only) Allow shoppers to sign-up for an account from the Checkout block Oct 28, 2020
@haszari
Copy link
Member Author

haszari commented Oct 28, 2020

I think we need to remove isExperimentalBuild() from these lines…

Thanks for the review @Aljullu - good catch. I've also added to proptypes and tweaked the title/changelog since checkout block is plugin-only.

I'll do another round of testing with release build and Woo 4.6.x and 4.7 RC to double-check there aren't any holes in the logic, then merge & ship 3.7.0 🚢

@haszari haszari merged commit 87fecc2 into trunk Oct 28, 2020
@haszari haszari deleted the fix/launch-checkout-signup-in-plugin branch October 28, 2020 21:42
@haszari haszari added the type: enhancement The issue is a request for an enhancement. label Oct 28, 2020
@haszari haszari mentioned this pull request Oct 28, 2020
19 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: checkout Issues related to the checkout block. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release checkout signup feature in blocks plugin (disable isExperimental feature gate)
4 participants