mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
add default values to Settings
This commit is contained in:
parent
c0c8e3f8cf
commit
792fce5b3a
2 changed files with 24 additions and 7 deletions
|
@ -223,7 +223,7 @@ return [
|
||||||
'title' => __('Buttons on Single Product', 'woocommerce-paypal-commerce-gateway'),
|
'title' => __('Buttons on Single Product', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __('Enable on Single Product', 'woocommerce-paypal-commerce-gateway'),
|
'label' => __('Enable on Single Product', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'default' => 1,
|
'default' => true,
|
||||||
'screens' => [
|
'screens' => [
|
||||||
State::STATE_PROGRESSIVE,
|
State::STATE_PROGRESSIVE,
|
||||||
State::STATE_ONBOARDED,
|
State::STATE_ONBOARDED,
|
||||||
|
@ -233,7 +233,7 @@ return [
|
||||||
'title' => __('Buttons on Mini Cart', 'woocommerce-paypal-commerce-gateway'),
|
'title' => __('Buttons on Mini Cart', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __('Enable on Mini Cart', 'woocommerce-paypal-commerce-gateway'),
|
'label' => __('Enable on Mini Cart', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'default' => 1,
|
'default' => true,
|
||||||
'screens' => [
|
'screens' => [
|
||||||
State::STATE_PROGRESSIVE,
|
State::STATE_PROGRESSIVE,
|
||||||
State::STATE_ONBOARDED,
|
State::STATE_ONBOARDED,
|
||||||
|
@ -243,7 +243,7 @@ return [
|
||||||
'title' => __('Buttons on Cart', 'woocommerce-paypal-commerce-gateway'),
|
'title' => __('Buttons on Cart', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __('Enable on Cart', 'woocommerce-paypal-commerce-gateway'),
|
'label' => __('Enable on Cart', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'default' => 1,
|
'default' => true,
|
||||||
'screens' => [
|
'screens' => [
|
||||||
State::STATE_PROGRESSIVE,
|
State::STATE_PROGRESSIVE,
|
||||||
State::STATE_ONBOARDED,
|
State::STATE_ONBOARDED,
|
||||||
|
@ -321,7 +321,7 @@ return [
|
||||||
'title' => __('Enable credit card on cart', 'woocommerce-paypal-commerce-gateway'),
|
'title' => __('Enable credit card on cart', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __('Allow your customers to pay with credit card directly in your cart.', 'woocommerce-paypal-commerce-gateway'),
|
'label' => __('Allow your customers to pay with credit card directly in your cart.', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'default' => 1,
|
'default' => true,
|
||||||
'screens' => [
|
'screens' => [
|
||||||
State::STATE_ONBOARDED,
|
State::STATE_ONBOARDED,
|
||||||
],
|
],
|
||||||
|
@ -330,7 +330,7 @@ return [
|
||||||
'title' => __('Enable credit card on mini cart', 'woocommerce-paypal-commerce-gateway'),
|
'title' => __('Enable credit card on mini cart', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __('Allow your customers to pay with credit card directly in your mini cart.', 'woocommerce-paypal-commerce-gateway'),
|
'label' => __('Allow your customers to pay with credit card directly in your mini cart.', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'default' => 1,
|
'default' => true,
|
||||||
'screens' => [
|
'screens' => [
|
||||||
State::STATE_ONBOARDED,
|
State::STATE_ONBOARDED,
|
||||||
],
|
],
|
||||||
|
@ -339,7 +339,7 @@ return [
|
||||||
'title' => __('Enable credit card on checkout', 'woocommerce-paypal-commerce-gateway'),
|
'title' => __('Enable credit card on checkout', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __('Allow your customers to pay with credit card in the checkout.', 'woocommerce-paypal-commerce-gateway'),
|
'label' => __('Allow your customers to pay with credit card in the checkout.', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'default' => 1,
|
'default' => true,
|
||||||
'screens' => [
|
'screens' => [
|
||||||
State::STATE_ONBOARDED,
|
State::STATE_ONBOARDED,
|
||||||
],
|
],
|
||||||
|
@ -348,7 +348,7 @@ return [
|
||||||
'title' => __('Enable credit card on products', 'woocommerce-paypal-commerce-gateway'),
|
'title' => __('Enable credit card on products', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __('Allow your customers to pay with credit card instantly on the product page.', 'woocommerce-paypal-commerce-gateway'),
|
'label' => __('Allow your customers to pay with credit card instantly on the product page.', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'default' => 1,
|
'default' => true,
|
||||||
'screens' => [
|
'screens' => [
|
||||||
State::STATE_ONBOARDED,
|
State::STATE_ONBOARDED,
|
||||||
],
|
],
|
||||||
|
|
|
@ -70,6 +70,23 @@ class Settings implements ContainerInterface
|
||||||
}
|
}
|
||||||
$this->settings = get_option(self::KEY, []);
|
$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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue