-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Change Checkout form step numbering so it can only be toggled for all blocks, not individually per-step #47479
Conversation
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
Hi @wavvves, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
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.
I was gonna say why complicate the code this much but yeah I agree that doing this is backward compatible.
The issue here is that if a step is already registered, it would have its number? How about:
- You remove the option from all steps.
- You leave the top level option.
- You apply your changes using CSS on the top level item, so that it overrides whatever option the consumer block had?
I'm not sure how to best do this, can be a follow up.
Can you expand on this point? You mean going from a 8.9 checkout with numbers enabled? This PR would disable them. If the merchant wants it back on they would have to enable the setting again. Along with the spacing changes I thought we agreed that the numbers added little value, so I don't think defaulting to them being disabled is a bad thing (given the effort required to re-enable them is minimal), do you agree? |
A change would be that any step inside Checkout would only be able to opt-out of steps numbers, not opt-in while the rest are opted out. |
It is controlled by the CheckoutBlockContext
ac61337
to
0697722
Compare
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.
LGTM
Changes proposed in this Pull Request:
This PR removes the "Show step number" option from individual form steps and adds a new toggle to the
Checkout Fields
block to control all form steps.I added a new property to the
CheckoutBlockContext
calledshowFormStepNumbers
and thefrontend.tsx
file for each Checkout inner block that renders a form step consumes the value from here and passes it to the form step. In the editor, theFormStepBlock
consumes this directly from theCheckoutBlockContext
.The reason I made each inner block pass the value to the
FormStep
is because theFormStep
component is exported in the@woocommerce/blocks-components
. I chose not to change the API of this or make it rely onCheckoutBlockContext
as it is possible the component may be rendered outside of this context and would break consuming applications.How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Contact Information
block and open the editor sidebar.Show step number
Checkout Fields Block
.Show form step numbers
Show form step numbers
option on.Use same address for billing
checkbox and ensure the numbers are still sequential when the billing form appears.Use same address for billing
checkbox and ensure the numbers are still sequential when the billing form appears.Changelog entry
Significance
Type
Message
Comment