mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🐛 Hide disabled APM buttons in Standard Payments
This commit is contained in:
parent
874ebbc7a0
commit
f3f6765ac3
3 changed files with 10 additions and 0 deletions
|
@ -250,11 +250,13 @@ class DataToAppleButtonScripts {
|
|||
$lang = $this->settings->has( 'applepay_button_language' ) ? $this->settings->get( 'applepay_button_language' ) : '';
|
||||
$lang = apply_filters( 'woocommerce_paypal_payments_applepay_button_language', $lang );
|
||||
$checkout_data_mode = $this->settings->has( 'applepay_checkout_data_mode' ) ? $this->settings->get( 'applepay_checkout_data_mode' ) : PropertiesDictionary::BILLING_DATA_MODE_DEFAULT;
|
||||
$is_enabled = $this->settings->has( 'applepay_button_enabled' ) && $this->settings->get( 'applepay_button_enabled' );
|
||||
|
||||
return array(
|
||||
'sdk_url' => $this->sdk_url,
|
||||
'is_debug' => defined( 'WP_DEBUG' ) && WP_DEBUG ? true : false,
|
||||
'is_admin' => true,
|
||||
'is_enabled' => $is_enabled,
|
||||
'preferences' => array(
|
||||
'checkout_data_mode' => $checkout_data_mode,
|
||||
),
|
||||
|
|
|
@ -94,6 +94,11 @@ class PreviewButton {
|
|||
* Will always create a new button in the DOM.
|
||||
*/
|
||||
render() {
|
||||
// The APM button is disabled and cannot be enabled on the current page: Do not render it.
|
||||
if (!this.isDynamic && !this.buttonConfig.is_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.domWrapper) {
|
||||
if (!this.wrapper) {
|
||||
console.error('Skip render, button is not configured yet');
|
||||
|
|
|
@ -418,9 +418,12 @@ class Button implements ButtonInterface {
|
|||
$shipping['countries'] = array_keys( $this->wc_countries()->get_shipping_countries() );
|
||||
}
|
||||
|
||||
$is_enabled = $this->settings->has( 'googlepay_button_enabled' ) && $this->settings->get( 'googlepay_button_enabled' );
|
||||
|
||||
return array(
|
||||
'environment' => $this->environment->current_environment_is( Environment::SANDBOX ) ? 'TEST' : 'PRODUCTION',
|
||||
'is_debug' => defined( 'WP_DEBUG' ) && WP_DEBUG ? true : false,
|
||||
'is_enabled' => $is_enabled,
|
||||
'sdk_url' => $this->sdk_url,
|
||||
'button' => array(
|
||||
'wrapper' => '#ppc-button-googlepay-container',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue