Refactor styles loading on GooglePay and ApplePay

Remove unnecessary console.log on GooglePay and ApplePay
This commit is contained in:
Pedro Silva 2023-10-19 18:44:44 +01:00
parent 567a7a2065
commit b11a539c24
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
6 changed files with 56 additions and 21 deletions

View file

@ -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(