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

Change Checkout form step numbering so it can only be toggled for all blocks, not individually per-step #47479

Merged
merged 24 commits into from
May 22, 2024

Conversation

opr
Copy link
Contributor

@opr opr commented May 14, 2024

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 called showFormStepNumbers and the frontend.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, the FormStepBlock consumes this directly from the CheckoutBlockContext.

The reason I made each inner block pass the value to the FormStep is because the FormStep component is exported in the @woocommerce/blocks-components. I chose not to change the API of this or make it rely on CheckoutBlockContext 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:

  1. Have local pickup enabled, with valid locations. Have shipping enabled with valid methods. Have payment methods set up.
  2. Go to the Checkout block in the editor.
  3. Click on the Contact Information block and open the editor sidebar.
  4. Ensure you do not see an option to Show step number
  5. Go to the list view and select the Checkout Fields Block.
  6. Open the editor sidebar and ensure you see an option to Show form step numbers
  7. Turn it on and ensure each step in the form has a number (Express payment, Order notes and Terms and Conditions don't have one).
  8. Turn it off and ensure none of the sections have a number.
  9. Save the page. Keep this editor tab open, you'll need it later!
  10. Open a new tab and add an item to your cart and go to the Checkout block in the front end.
  11. Ensure none of the sections have a number.
  12. Go back to the editor and toggle the Show form step numbers option on.
  13. Reload the front-end Checkout block and ensure all sections (except order notes and T&C) have a number.
  14. Check the Use same address for billing checkbox and ensure the numbers are still sequential when the billing form appears.
  15. Uncheck the Use same address for billing checkbox and ensure the numbers are still sequential when the billing form appears.
  16. Change the shipping method from Shipping to Local pickup and vice/versa checking the numbering is still OK in each configuration.
  17. Go back to the editor, delete the Checkout block and re-insert it. Ensure the numbers are not shown by default.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label May 14, 2024
Copy link
Contributor

github-actions bot commented May 14, 2024

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

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.

@opr opr marked this pull request as ready for review May 15, 2024 10:58
@woocommercebot woocommercebot requested review from a team and wavvves and removed request for a team May 15, 2024 10:58
@opr opr added focus: checkout Issues related to checkout page. team: Rubik Store API checkout endpoints, Mini-Cart, Cart and Checkout related issues block: checkout Issues related to the checkout block. labels May 15, 2024
Copy link
Contributor

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:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Member

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

@opr
Copy link
Contributor Author

opr commented May 20, 2024

The issue here is that if a step is already registered, it would have its number

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?

@senadir
Copy link
Member

senadir commented May 20, 2024

What I mean is that if you install EU VAT, it will show a step number

image

@senadir
Copy link
Member

senadir commented May 20, 2024

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.

@wavvves wavvves removed their request for review May 20, 2024 19:40
@opr opr force-pushed the update/global-show-form-step-numbers branch from ac61337 to 0697722 Compare May 21, 2024 13:58
Copy link
Member

@senadir senadir left a comment

Choose a reason for hiding this comment

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

LGTM

@opr opr merged commit b7643b9 into trunk May 22, 2024
36 checks passed
@opr opr deleted the update/global-show-form-step-numbers branch May 22, 2024 14:03
@github-actions github-actions bot added this to the 9.0.0 milestone May 22, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label May 22, 2024
@Stojdza Stojdza added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block: checkout Issues related to the checkout block. focus: checkout Issues related to checkout page. needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris team: Rubik Store API checkout endpoints, Mini-Cart, Cart and Checkout related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants