diff --git a/modules.local/ppcp-wc-gateway/services.php b/modules.local/ppcp-wc-gateway/services.php index 22a6100ff..b923b8055 100644 --- a/modules.local/ppcp-wc-gateway/services.php +++ b/modules.local/ppcp-wc-gateway/services.php @@ -223,7 +223,7 @@ return [ 'title' => __('Buttons on Single Product', 'woocommerce-paypal-commerce-gateway'), 'type' => 'checkbox', 'label' => __('Enable on Single Product', 'woocommerce-paypal-commerce-gateway'), - 'default' => 1, + 'default' => true, 'screens' => [ State::STATE_PROGRESSIVE, State::STATE_ONBOARDED, @@ -233,7 +233,7 @@ return [ 'title' => __('Buttons on Mini Cart', 'woocommerce-paypal-commerce-gateway'), 'type' => 'checkbox', 'label' => __('Enable on Mini Cart', 'woocommerce-paypal-commerce-gateway'), - 'default' => 1, + 'default' => true, 'screens' => [ State::STATE_PROGRESSIVE, State::STATE_ONBOARDED, @@ -243,7 +243,7 @@ return [ 'title' => __('Buttons on Cart', 'woocommerce-paypal-commerce-gateway'), 'type' => 'checkbox', 'label' => __('Enable on Cart', 'woocommerce-paypal-commerce-gateway'), - 'default' => 1, + 'default' => true, 'screens' => [ State::STATE_PROGRESSIVE, State::STATE_ONBOARDED, @@ -321,7 +321,7 @@ return [ 'title' => __('Enable credit card on cart', 'woocommerce-paypal-commerce-gateway'), 'type' => 'checkbox', 'label' => __('Allow your customers to pay with credit card directly in your cart.', 'woocommerce-paypal-commerce-gateway'), - 'default' => 1, + 'default' => true, 'screens' => [ State::STATE_ONBOARDED, ], @@ -330,7 +330,7 @@ return [ 'title' => __('Enable credit card on mini cart', 'woocommerce-paypal-commerce-gateway'), 'type' => 'checkbox', 'label' => __('Allow your customers to pay with credit card directly in your mini cart.', 'woocommerce-paypal-commerce-gateway'), - 'default' => 1, + 'default' => true, 'screens' => [ State::STATE_ONBOARDED, ], @@ -339,7 +339,7 @@ return [ 'title' => __('Enable credit card on checkout', 'woocommerce-paypal-commerce-gateway'), 'type' => 'checkbox', 'label' => __('Allow your customers to pay with credit card in the checkout.', 'woocommerce-paypal-commerce-gateway'), - 'default' => 1, + 'default' => true, 'screens' => [ State::STATE_ONBOARDED, ], @@ -348,7 +348,7 @@ return [ 'title' => __('Enable credit card on products', 'woocommerce-paypal-commerce-gateway'), 'type' => 'checkbox', 'label' => __('Allow your customers to pay with credit card instantly on the product page.', 'woocommerce-paypal-commerce-gateway'), - 'default' => 1, + 'default' => true, 'screens' => [ State::STATE_ONBOARDED, ], diff --git a/modules.local/ppcp-wc-gateway/src/Settings/Settings.php b/modules.local/ppcp-wc-gateway/src/Settings/Settings.php index beb5fcdc8..7141e7637 100644 --- a/modules.local/ppcp-wc-gateway/src/Settings/Settings.php +++ b/modules.local/ppcp-wc-gateway/src/Settings/Settings.php @@ -70,6 +70,23 @@ class Settings implements ContainerInterface } $this->settings = get_option(self::KEY, []); + $defaults = [ + 'title' => __('PayPal', 'woocommerce-paypal-commerce-gateway'), + 'description' => __('Pay via PayPal; you can pay with your credit card if you don\'t have a PayPal account.', 'woocommerce-paypal-commerce-gateway'), + 'button_single_product_enabled' => true, + 'button_mini_cart_enabled' => true, + 'button_cart_enabled' => true, + 'dcc_cart_enabled' => true, + 'dcc_mini_cart_enabled' => true, + 'dcc_checkout_enabled' => true, + 'dcc_single_product_enabled' => true, + ]; + foreach ($defaults as $key => $value) { + if (isset($this->settings[$key])) { + continue; + } + $this->settings[$key] = $value; + } return true; } }