mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge pull request #2756 from woocommerce/PCP-3830-google-pay-and-apple-pay-as-separate-gateways-place-order-button-when-classic-checkout-removed-from-smart-button-location
Google Pay and Apple Pay as separate gateways does not show button when checkout remove from button locations (3830)
This commit is contained in:
commit
d00cf4c2c4
3 changed files with 33 additions and 1 deletions
|
@ -168,6 +168,20 @@ class ApplepayModule implements ServiceModule, ExtendingModule, ExecutableModule
|
|||
}
|
||||
);
|
||||
|
||||
add_filter(
|
||||
'woocommerce_paypal_payments_selected_button_locations',
|
||||
function( array $locations, string $setting_name ): array {
|
||||
$gateway = WC()->payment_gateways()->payment_gateways()[ ApplePayGateway::ID ] ?? '';
|
||||
if ( $gateway && $gateway->enabled === 'yes' && $setting_name === 'smart_button_locations' ) {
|
||||
$locations[] = 'checkout';
|
||||
}
|
||||
|
||||
return $locations;
|
||||
},
|
||||
10,
|
||||
2
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -218,6 +218,20 @@ class GooglepayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
|||
}
|
||||
);
|
||||
|
||||
add_filter(
|
||||
'woocommerce_paypal_payments_selected_button_locations',
|
||||
function( array $locations, string $setting_name ): array {
|
||||
$gateway = WC()->payment_gateways()->payment_gateways()[ GooglePayGateway::ID ] ?? '';
|
||||
if ( $gateway && $gateway->enabled === 'yes' && $setting_name === 'smart_button_locations' ) {
|
||||
$locations[] = 'checkout';
|
||||
}
|
||||
|
||||
return $locations;
|
||||
},
|
||||
10,
|
||||
2
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,11 @@ class SettingsStatus {
|
|||
protected function is_enabled_for_location( string $setting_name, string $location ): bool {
|
||||
$location = $this->normalize_location( $location );
|
||||
|
||||
$selected_locations = $this->settings->has( $setting_name ) ? $this->settings->get( $setting_name ) : array();
|
||||
$selected_locations = apply_filters(
|
||||
'woocommerce_paypal_payments_selected_button_locations',
|
||||
$this->settings->has( $setting_name ) ? $this->settings->get( $setting_name ) : array(),
|
||||
$setting_name
|
||||
);
|
||||
|
||||
if ( empty( $selected_locations ) ) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue