mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Fix GooglePay and ApplePay loading scripts on admin standard payments page.
This commit is contained in:
parent
ac7779bc41
commit
c8d4c12a2d
3 changed files with 9 additions and 2 deletions
|
@ -164,6 +164,7 @@ class ApplepayModule implements ModuleInterface {
|
|||
assert( $smart_button instanceof SmartButtonInterface );
|
||||
if ( $smart_button->should_load_ppcp_script() ) {
|
||||
$button->enqueue();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( has_block( 'woocommerce/checkout' ) || has_block( 'woocommerce/cart' ) ) {
|
||||
|
@ -196,7 +197,7 @@ class ApplepayModule implements ModuleInterface {
|
|||
add_action(
|
||||
'admin_enqueue_scripts',
|
||||
static function () use ( $c, $button ) {
|
||||
if ( ! is_admin() ) {
|
||||
if ( ! is_admin() || ! $c->get( 'wcgateway.is-ppcp-settings-standard-payments-page' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ class GooglepayModule implements ModuleInterface {
|
|||
assert( $smart_button instanceof SmartButtonInterface );
|
||||
if ( $smart_button->should_load_ppcp_script() ) {
|
||||
$button->enqueue();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( has_block( 'woocommerce/checkout' ) || has_block( 'woocommerce/cart' ) ) {
|
||||
|
@ -111,7 +112,7 @@ class GooglepayModule implements ModuleInterface {
|
|||
add_action(
|
||||
'admin_enqueue_scripts',
|
||||
static function () use ( $c, $button ) {
|
||||
if ( ! is_admin() ) {
|
||||
if ( ! is_admin() || ! $c->get( 'wcgateway.is-ppcp-settings-standard-payments-page' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -182,6 +182,11 @@ return array(
|
|||
);
|
||||
},
|
||||
|
||||
'wcgateway.is-ppcp-settings-standard-payments-page' => static function ( ContainerInterface $container ): bool {
|
||||
return $container->get( 'wcgateway.is-ppcp-settings-page' )
|
||||
&& $container->get( 'wcgateway.current-ppcp-settings-page-id' ) === PayPalGateway::ID;
|
||||
},
|
||||
|
||||
'wcgateway.current-ppcp-settings-page-id' => static function ( ContainerInterface $container ): string {
|
||||
if ( ! $container->get( 'wcgateway.is-ppcp-settings-page' ) ) {
|
||||
return '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue