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

Payment form JS isn't loaded at checkout for free orders #326

Open
ChaseWiseman opened this issue Nov 15, 2018 · 4 comments
Open

Payment form JS isn't loaded at checkout for free orders #326

ChaseWiseman opened this issue Nov 15, 2018 · 4 comments
Labels
Bug Raises or fixes a bug Payment Gateway Payment gateway code or issues

Comments

@ChaseWiseman
Copy link
Contributor

ChaseWiseman commented Nov 15, 2018

When an order starts out as free at checkout, core doesn't render the payment methods UI. If the customer updates checkout, like choosing a new shipping method and $$$ needs to be charged, core refreshes checkout and ends up rendering the our gateway payment fields.

However, the way we enqueue the payment form JS handler means it'll only be present on initial page load, and not come along with any AJAX refreshes.

We'll need to change how we enqueue the JS so that it's present in the payment method form UI itself, or figure out some other way to load it on refresh.

  • Report from: HS convo 94602 would like for the JavaScript to not show up on all their pages.
@ChaseWiseman ChaseWiseman added Bug Raises or fixes a bug Payment Gateway Payment gateway code or issues labels Nov 15, 2018
@lkraav
Copy link

lkraav commented Nov 15, 2018

Hi @ChaseWiseman. I just happened to post https://wordpress.org/support/topic/2-2-0-please-stop-enqueuing-payment-javascript-sitewide/ yesterday.

Your issue description here sounds like it could be related to my concerns, and perhaps could be addressed with this re-arrangement work. Wdyt?

EDIT traced my issue to https://github.com/skyverge/wc-plugin-framework/blob/master/woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php#L354

@ChaseWiseman
Copy link
Contributor Author

@lkraav yep I think this would be a good place to look at that as well.

One thing about some of these more modern gateways is that they will need to enqueue their scripts on more and more pages outside of checkout as we add things like Apple Pay and express checkout (via PayPal in Braintree's case) since those are to be made available on the single product pages, cart, and even archive pages in the future.

But it's still good to keep these concerns in mind and limit things where we can!

@lkraav
Copy link

lkraav commented Nov 15, 2018

One thing about some of these more modern gateways is that they will need to enqueue their scripts on more and more pages

I would love to have a say in the "maybe" decision via add_filter()

@ChaseWiseman ChaseWiseman added this to the v5.3.1 milestone Dec 5, 2018
@JulieSkyVerge
Copy link

Added:

  • Report from: HS convo 94602 would like for the JavaScript to not show up on all their pages.

@ChaseWiseman ChaseWiseman removed this from the v5.3.1 milestone Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Raises or fixes a bug Payment Gateway Payment gateway code or issues
Projects
None yet
Development

No branches or pull requests

3 participants