9
9
10
10
namespace WooCommerce \PayPalCommerce \Settings \Data \Definition ;
11
11
12
+ use WooCommerce \PayPalCommerce \Settings \Data \SettingsModel ;
12
13
use WooCommerce \PayPalCommerce \Settings \Service \FeaturesEligibilityService ;
13
14
use WooCommerce \PayPalCommerce \Settings \Data \GeneralSettings ;
14
15
@@ -42,21 +43,31 @@ class FeaturesDefinition {
42
43
*/
43
44
protected array $ merchant_capabilities ;
44
45
46
+ /**
47
+ * The plugin settings.
48
+ *
49
+ * @var SettingsModel
50
+ */
51
+ protected SettingsModel $ plugin_settings ;
52
+
45
53
/**
46
54
* Constructor.
47
55
*
48
56
* @param FeaturesEligibilityService $eligibilities The features eligibility service.
49
57
* @param GeneralSettings $settings The general settings service.
50
58
* @param array $merchant_capabilities The merchant capabilities.
59
+ * @param SettingsModel $plugin_settings The plugin settings.
51
60
*/
52
61
public function __construct (
53
62
FeaturesEligibilityService $ eligibilities ,
54
63
GeneralSettings $ settings ,
55
- array $ merchant_capabilities
64
+ array $ merchant_capabilities ,
65
+ SettingsModel $ plugin_settings
56
66
) {
57
67
$ this ->eligibilities = $ eligibilities ;
58
68
$ this ->settings = $ settings ;
59
69
$ this ->merchant_capabilities = $ merchant_capabilities ;
70
+ $ this ->plugin_settings = $ plugin_settings ;
60
71
}
61
72
62
73
/**
@@ -82,7 +93,7 @@ public function get(): array {
82
93
* @return array[] The array of all available features.
83
94
*/
84
95
public function all_available_features (): array {
85
- $ paylater_countries = array (
96
+ $ paylater_countries = array (
86
97
'UK ' ,
87
98
'ES ' ,
88
99
'IT ' ,
@@ -91,8 +102,9 @@ public function all_available_features(): array {
91
102
'DE ' ,
92
103
'AU ' ,
93
104
);
94
- $ store_country = $ this ->settings ->get_woo_settings ()['country ' ];
95
- $ country_location = in_array ( $ store_country , $ paylater_countries , true ) ? strtolower ( $ store_country ) : 'us ' ;
105
+ $ store_country = $ this ->settings ->get_woo_settings ()['country ' ];
106
+ $ country_location = in_array ( $ store_country , $ paylater_countries , true ) ? strtolower ( $ store_country ) : 'us ' ;
107
+ $ save_paypal_and_venmo = $ this ->plugin_settings ->get_save_paypal_and_venmo ();
96
108
97
109
return array (
98
110
'save_paypal_and_venmo ' => array (
@@ -104,8 +116,8 @@ public function all_available_features(): array {
104
116
'type ' => 'secondary ' ,
105
117
'text ' => __ ( 'Configure ' , 'woocommerce-paypal-payments ' ),
106
118
'action ' => array (
107
- 'type ' => 'tab ' ,
108
- 'tab ' => 'settings ' ,
119
+ 'type ' => 'tab ' ,
120
+ 'tab ' => 'settings ' ,
109
121
'section ' => 'ppcp-save-paypal-and-venmo ' ,
110
122
),
111
123
'showWhen ' => 'enabled ' ,
@@ -288,7 +300,7 @@ public function all_available_features(): array {
288
300
'Let customers know they can buy now and pay later with PayPal. Adding this messaging can boost conversion rates and increase cart sizes by 39%¹, with no extra cost to you—plus, you get paid up front. ' ,
289
301
'woocommerce-paypal-payments '
290
302
),
291
- 'enabled ' => $ this ->merchant_capabilities ['pay_later ' ],
303
+ 'enabled ' => $ this ->merchant_capabilities ['pay_later ' ] && ! $ save_paypal_and_venmo ,
292
304
'buttons ' => array (
293
305
array (
294
306
'type ' => 'secondary ' ,
0 commit comments