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

Prevent rendering fields if should not; use hosted pages instead #118

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

makotom
Copy link
Contributor

@makotom makotom commented Jun 7, 2024

Overview

This PR introduces logics to avoid rendering hosted fields under circumstances that it shouldn't be rendered.

Background

With 3.1.0, we introduced these 2 changes:

  • Support of checkout blocks
  • "Truthy" default descriptions of payment methods

As a result an unexpected behaviour was introduced, with which it attempts to render hosted fields unconditionally, even though inline fields are disabled or the publishable key is unset.

It's also worth to mention that there's a non-intuitive design in the WC side for checkout shortcodes. Blocks just need an extra logic to control the behaviour.

Changes introduced

This PR makes these two specific changes:

  • For shortcodes: Avoid using default descriptions if other parameters except descriptions indicate that inline fields shouldn't be rendered. This will allow merchants to control rendering of fields by giving blank descriptions. This change also emulates the behaviour in 3.0.9.
  • For blocks: Implement an apparatus to tell frontend scripts if it should render fields; the front end script is also revised to honour the passed parameter.

@makotom makotom marked this pull request as ready for review June 7, 2024 07:29
@Dinwy
Copy link
Collaborator

Dinwy commented Jun 11, 2024

LGTM

Great! Now inline payment is unchecked it is not showing anymore.
Based on this PR, I will fix my #117

@Dinwy Dinwy merged commit f519433 into master Jun 11, 2024
4 checks passed
@Dinwy Dinwy mentioned this pull request Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants