-
Notifications
You must be signed in to change notification settings - Fork 72
Express Payment button not visibile on the Cart template #10043
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
Comments
A quick note while triaging, I am able to see the express checkout buttons on the cart page when going to |
Please add your planning poker estimate with Zenhub @FangedParakeet |
In #10141 I'm proposing to stop using the Stripe Elements API to load the previews, and instead use the APIs provided directly by Google (https://developers.google.com/pay/api/web/guides/resources/customize) and Apple (https://developer.apple.com/documentation/apple_pay_on_the_web/displaying_apple_pay_buttons_using_css). Here's how it looks in the Apple Pay / Google Pay Settings page (using Stripe): Here's in the Template Editor (which previously didn't load, now it's using the Apple Pay and Google Pay APIs directly): And here's in the live Cart page (Using Stripe): Here is another example using different settings: Settings: Template Editor: Cart Page: In this last screenshot there seems to be an error with the margin calculation done by Stripe when using Safari, but it's outside of our control. Finally here are screenshots using the Outline theme. Settings: Template Editor: Cart Page: In Chrome the borders render fine (Although Apple Pay is not supported, so it won't render at all): |
I created a follow-up issue to track the problem with the white/outline buttons in safari (I also confirmed that the issue is present in the current |
Just dropping a last call for feedback on this issue. It appears that the current solution in #10141 is a large improvement over the non-functionality reported in this issue, has been reviewed by Heisenberg, and offers visual parity with checkout with the sole exception of the difference described in #10258, which can be completed as a follow-up issue. I've added this issue to the 8.9.0 milestone and we will look to merge our solution before the end of the week, since the PR has been approved. Am extending a final opportunity to suggest any alterations to the given solution, in case there is any critical shortfall in visual appearance or functionality. Let us know if anyone has any cause to pause and review the implementation here, otherwise we will be closing out this issue once merged and if there are further changes required, we can continue the conversation in #10248. Cheers in advance and apologies for frivolous pings! 🙏 |
At some point soon Amazon Pay may be added. Stripe Link is an option and Klarna is in Beta. So if this isn't scalable I'd suggest other options. |
We could limit the new solution to Google Pay/Apple Pay only, and once the new express payment methods are added we can work individually in their previews (in the meantime the previews would be rendered using Stripe, although that may not work in the template editor as explained in the present issue). The only other alternative would be to use regular unstyled buttons as placeholders. |
Amazon might be easier to have a placeholder since it has only 1 theme and no configurable text. In principle using real not dummy data is preferred as it scales better and is easier to maintain. |
I'll add a change to my PR so when a new express payment method is added it will use the Stripe preview, that should give us time to implement the custom preview button in the future. |
@danielmx-dev one thing I need to clear up for my understanding. Brian was able to see the buttons in the editor, and Raluca was not. What's the difference? |
The buttons will show up when using the page editor but they won't when using the template editor (FSE). Although these editors are really similar, the template editor is actually using an iframe to display a preview of the website. The Stripe iframe that we use to display the express checkout buttons don't work as expected when embedded inside this internal iframe. I wasn't able to find any solutions to this particular problem. |
@nerrad education opportunity for me here, do you have any historical background why the editor edits in these two ways? Is it because the template has to be inserted into the page? Does this cause a broader issue for payments where iFrame usage is common. |
Some original context here on when template/site editors were moved to be in an iframe. When this was initially added, the post editor was not iframed, however that has changed (as of WP 6.3). Now if all registered blocks are using the latest I'm not sure what exactly prompted the different experiences here but read over those posts (particularly the WP 6.3 link) because I suspect there is a way assets can be registered so they work in both contexts - it's possible WooPayments isn't following the recommended path here. |
Helpful thank you as always @nerrad. @danielmx-dev @FangedParakeet what's your take on the suggested options within @ellatrix post? |
The linked resources are very helpful; however, the issue still can't be fixed since there are dependencies outside of our control. Using the provided
This means that the Stripe library detects that the iframe is using HTTP as its protocol even if the parent page is being served through HTTPS. My guess is that the library is looking at the Besides the issue above, it looks like the |
Thanks @danielmx-dev for diving into that. @ellatrix I'm keen to get your thoughts here as payments is an area that's often more complex and that has different needs/realities. The implication is that things related to payments like express checkout buttons, BNPL messaging, and payment methods may not render at all in FSE or it provides misleading UI to users who may think the site or the payment provider is not functioning. Daniel was looking at a workaround above. I'm highly concerned about going down that path. It's not true to live production experience and because it puts the burden on the plugin to figure out how to manage two different implementations and to keep them in sync...especially if some of the decisions to show or not show a button are out of our control and it can't be simulated with confidence. |
Hi @danielmx-dev 👋 I'm the release lead of WooPayments 9.0.0. I was checking the previous GH milestone (8.9.0) and this issue is part of it. Given the recent release, would it be okay to remove this issue from the 8.9.0 milestone? Thanks for your help! |
Thanks for the heads up @mgascam, I have removed this issue from the previous 8.9.0 milestone. I'll keep the field empty until the issue is unblocked. |
@ralucaStan want to get your perspective as well and if we should pull this into an internal discussion as this seems like a blocker for payments integrations. |
I just want to quickly sum up our potential options and the various pitfalls here for @ralucaStan. Essentially, the preview for EPM buttons on the blocks FSE is not loading correctly, since the button iframe is not loading correctly within the FSE iframe, as described in #10043 (comment). The solution that @danielmx-dev has devised bypasses Stripe and uses custom Google and Apple libraries to present a preview of the button in #10141. This code is custom though relatively compact and has the following characteristics.
The ideal solution would be to incorporate Stripe's payment element, as this would be the most maintainable and likely only involve a single of difference between implementation for different payment methods (setting the payment method type). We could delay this resolution and seek to understand how we could defeat our iframing issues, but this would take significant effort and the pathway towards achieving this does not seem immediately apparent. One more solution could be to use a static placeholder to present this preview as a short-term solution. This would be lightweight and could also incorporate custom checkout styling. However, this would be challenging to maintain, as we would need to be vigilant of the malleable appearance of the button at checkout and could run afoul of violating recommended appearance if Stripe/Apple/Google decide to drastically modify the appearance of their button at checkout. We would essentially need to maintain this preview manually and reactively, which would be challenging and repetitive. Hopefully, I managed to summarise this scenario somewhat accurately, but feel free to let us know if you have any more questions! |
Thank you for the ping.
It's good that the solution from #10141 renders buttons, but do they react when the Apply uniform styles option? If we could make them react then we could use this as a temporary solution until we iterate more on the iframing issues. I prefer this over the static placeholder. |
Thanks for your input @ralucaStan
Yes, the buttons react to the available uniform styles options: |
@pierorocca given that the workaround meets the required criteria, should we move forward with it? Or do you have other concerns that should be addressed before moving forward? |
@danielmx-dev Samir sums up the issues well. My main concern is we're creating a non-tenable scenario by having the editor be a different implementation that the front-end. Sooner than later we're going to need a way around this limitation and was hoping we'd get an informed perspective from @ellatrix. In this direct implementation I assume the same browser compatibility matrix applies to the Stripe implementation? i.e. we're not showing Apple Pay as being visible on desktop Chrome? |
This is correct. |
It sounds like the last blocker here is the I'm not sure if it's possible to initialise the script outside of the iframe and target an element within the iframe, while also adding the styles within the iframe. I don't know how the Stripe API works. But that could be an alternative solution. |
@ellatrix, is there a reason why WordPress/gutenberg#55152 wasn't continued? That PR looks quite old: is there a way to build off of or continue the work that was commenced in that PR? Currently, the perfect, optimal solution would be to reuse the Stripe element inside the FSE iframe, after resolving the issues with Gutenberg. However, to me at least since I have a lot less familiarity with Gutenberg, the pathway to get there still seems a little unclear. If we found a solution in Gutenberg to solve the blob/iframe kerfuffle, we would need to retest our integration to see if our Stripe component would then play nicely with it and, if not, we would regretfully be back where we started. Are we able to perhaps size this effort on the Gutenberg side or is there any clear timeline to understand when this might be available to us?
I believe this might not be viable sadly, but I will defer to @danielmx-dev. With regards to our available options, the provided solution in #10141 does appear to match the customisability and appearance presented by Stripe's own element. It may not be fully extensible, but considering the effort required to create the PR, I feel an effort to add other future express payment methods to this implementation would be sized similarly or smaller. If we could more clearly understand the pathway to get to an optimal solution without the iframe friction, I think that would help us to understand the benefit of using #10141 as a stop-gap solution instead. If this seems like a solution that is within our reach now, I would definitely support pausing the work on #10141 to focus on that much preferred option instead. If the optimal solution seems like it might be a medium-term solution, available sometime in Q2 or early Q3 let's say, I think it makes sense to use #10141 as a stop-gap solution, since this short-term fix is already ready now and by the time we are at the point of being ready to integrate new EPMs that would make this implemented fix suffer, we would also be ready to replace #10141 with our optimal Stripe iframe iteration instead. If the optimal solution seems like it might be a long-term solution, available sometime even later than that, then I also think that #10141 has value as a stop-gap solution, since no other solution appears to be available and until the point that there is one, we would simply be unable to show any preview of the EPM button within the cart template at all. That's my assessment of our current predicament at my own level of understanding so far, but let me know if anyone has any wiser opinions or can answer any of the questions I posed with regards to resolving this scenario via Gutenberg. 🙏 |
Why was it not finished before? Because there was only one problem with it and I wanted to leave time to find other approaches or solutions. I would've rather seen a fix that made the blob protocol work. However, with additional issues, maybe it should be done. All these Gutenberg things are currently on hold. That's not to say that a temporary hack on the WooCommerce side would not be possible, but that again increases the maintenance cost. I'm not sure what's the best thing to do here. |
I've inquired whether it's something that could make the next WP release or not. |
It can definitely not make the this WP release. |
It sounds like sadly this solution will not be something that is within our grasp in the near-future. I believe, referring back to #10043 (comment) this sets us in either of the two following scenarios.
@pierorocca, are you still opposed to using #10141 as even a temporary solution until we are able to resolve this more holistically with Gutenberg support? The only other alternative is that we mark this issue |
I don't think we have any choice at this moment except to fake it and deal with the consequences of the editor experience possibly not reflecting the live front-end experience. Thanks all for doing the due diligence on this and sharing info across functions. :) |
Describe the bug
When visiting the Page: Cart template, the button for express payment is not visible in the Cart block
To Reproduce
Actual behavior
The buttons are visible when navigating to the block via the Post editor. Admin > Pages > Cart
Screenshots
Page: Cart template

Cart Page

Expected behavior
The express payment buttons should show in the editor for the template as well
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: