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

Integrate express payments buttonAttributes API from the Checkout Block #3164

Merged
merged 18 commits into from
Sep 4, 2024

Conversation

alexflorisca
Copy link
Member

@alexflorisca alexflorisca commented May 29, 2024

Changes proposed in this Pull Request:

This PR uses the buttonAttributes API introduced in Woo Core in Add new buttonAttributes API to style express checkout buttons coherently. This will respect the new height and borderRadius controls on the express checkout block, overriding extension settings when these are available. It also uses the darkMode setting to override the button theme.

This means the Stripe specific settings are still applied if we're not in a checkout block context. But if we are, the button styles will be synced across all express payment buttons that have integrated with this API.

Note: At the moment, the borderRadius property is not available on the PRB API. This will be used once the switch is made to ECE.

Testing instructions

  1. Add some items to the cart and visit the cart page (with the cart block)
  2. Ensure the express payment method is visible there (Link, GPay or Apple Pay)
  3. Click "Proceed to checkout"
  4. Ensure the express payment method is visible there too
  5. In a new tab, open the checkout page in the editor.
  6. Click on the express checkout area and change the button size to "Large"
  7. The express payment button height should be 55px
  8. Visit the express payment settings page.
  9. A notice should read Some appearance settings may be overridden by the express payment section of the Cart & Checkout blocks.
  10. Check the link takes you to the Checkout Block

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@alexflorisca alexflorisca added component: blocks Cart and checkout blocks category: compatibility (In)Compatibility with other plugins or extensions labels May 29, 2024
@alexflorisca alexflorisca changed the title POC: Receive button properties from the Checkout Block Integrate express payments buttonAttributes API from the Checkout Block Aug 12, 2024
@alexflorisca alexflorisca marked this pull request as ready for review August 14, 2024 10:13
@alexflorisca alexflorisca requested review from a team and diegocurbelo and removed request for a team August 14, 2024 10:40
@alexflorisca
Copy link
Member Author

Not sure about your release process or which version this will end up in so I've not edited the changelog. Let me know what you prefer here.

@diegocurbelo diegocurbelo added this to the 8.7.0 milestone Aug 20, 2024
@alexflorisca
Copy link
Member Author

It's worth noting here that it was decided to postpone the release of the buttonAttributes API until WC 9.4 release. The code here should work regardless, as we're checking to see if the type of buttonAttributes is undefined. However, testing should be done against the feature/express-payment-improvements branch in Woo Core. The PR that contains this work is woocommerce/woocommerce#50791.

One of the reasons we did this is to allow the major payment gateways to integrate with this before we ship it. So this should still be merged and released ahead of Woo Core.

@alexflorisca
Copy link
Member Author

Just a note to say that the darkMode prop was removed from the API in woocommerce/woocommerce#51109. I just updated this PR accordingly

@diegocurbelo How's the review for this going?

@wjrosa wjrosa removed the request for review from diegocurbelo September 4, 2024 12:04
@wjrosa wjrosa self-requested a review September 4, 2024 12:04
Copy link
Contributor

@wjrosa wjrosa left a comment

Choose a reason for hiding this comment

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

Change looks good and it works as expected:

  1. Ensure the express payment method is visible there (Link, GPay or Apple Pay)

https://github.com/user-attachments/assets/5f15294c-acae-48eb-b68e-53012947e912

  1. Ensure the express payment method is visible there too

https://github.com/user-attachments/assets/fe44ecc3-c710-4931-811a-d8280b9a40d4

  1. The express payment button height should be 55px

https://github.com/user-attachments/assets/551a3e3f-db64-44d7-824c-af78e3ad80ad

  1. A notice should read Some appearance settings may be overridden by the express payment section of the Cart & Checkout blocks.

Screenshot 2024-09-04 at 11 39 41

  1. Check the link takes you to the Checkout Block

It does 👍

@wjrosa wjrosa merged commit 88fc09a into develop Sep 4, 2024
34 of 35 checks passed
@wjrosa wjrosa deleted the try/poc-express-checkout-button-styles branch September 4, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: compatibility (In)Compatibility with other plugins or extensions component: blocks Cart and checkout blocks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants