mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Refactor styles loading on GooglePay and ApplePay
Remove unnecessary console.log on GooglePay and ApplePay
This commit is contained in:
parent
567a7a2065
commit
b11a539c24
6 changed files with 56 additions and 21 deletions
|
@ -136,10 +136,18 @@ class ApplepayModule implements ModuleInterface {
|
|||
assert( $button instanceof ApplePayButton );
|
||||
$smart_button = $c->get( 'button.smart-button' );
|
||||
assert( $smart_button instanceof SmartButtonInterface );
|
||||
$page_has_block = has_block( 'woocommerce/checkout' ) || has_block( 'woocommerce/cart' );
|
||||
if ( $smart_button->should_load_ppcp_script() || $page_has_block ) {
|
||||
if ( $smart_button->should_load_ppcp_script() ) {
|
||||
$button->enqueue();
|
||||
}
|
||||
|
||||
if ( has_block( 'woocommerce/checkout' ) || has_block( 'woocommerce/cart' ) ) {
|
||||
/**
|
||||
* Should add this to the ButtonInterface.
|
||||
*
|
||||
* @psalm-suppress UndefinedInterfaceMethod
|
||||
*/
|
||||
$button->enqueue_styles();
|
||||
}
|
||||
}
|
||||
);
|
||||
add_action(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue