Always load GooglePay scripts on checkout page

This commit is contained in:
Philipp Stracker 2024-08-27 12:32:53 +02:00
parent 15a09d9722
commit 07c73985e3
No known key found for this signature in database

View file

@ -94,16 +94,20 @@ class GooglepayModule implements ModuleInterface {
$smart_button = $c->get( 'button.smart-button' );
assert( $smart_button instanceof SmartButtonInterface );
/*
* TODO: When PayLater is disabled and we're in "continuation" context, then no JS is enqueued.
* Find a solution to enqueue the CheckoutBootstrap module in that situation.
*/
if ( $smart_button->should_load_ppcp_script() ) {
$button->enqueue();
return;
}
/*
* Checkout page, but no PPCP scripts were loaded. Most likely in continuation mode.
* Need to enqueue some Google Pay scripts to populate the billing form with details
* provided by Google Pay.
*/
if ( is_checkout() ) {
$button->enqueue();
}
if ( has_block( 'woocommerce/checkout' ) || has_block( 'woocommerce/cart' ) ) {
/**
* Should add this to the ButtonInterface.