Todos: Remove the Credit Card item and change the link for the Subscriptions item

This commit is contained in:
Daniel Dudzic 2025-02-21 14:47:49 +01:00
parent 30c5931f55
commit bf1b1f8ad8
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
3 changed files with 5 additions and 44 deletions

View file

@ -349,8 +349,7 @@ return array(
'settings.data.definition.todos' => static function ( ContainerInterface $container ) : TodosDefinition {
return new TodosDefinition(
$container->get( 'settings.service.todos_eligibilities' ),
$container->get( 'settings.data.general' ),
$container->get( 'wc-subscriptions.helper' )
$container->get( 'settings.data.general' )
);
},
'settings.data.definition.methods' => static function ( ContainerInterface $container ) : PaymentMethodsDefinition {
@ -435,7 +434,6 @@ return array(
* 3. $gateways, $pay_later_statuses, $button_locations - Plugin settings (enabled/disabled status).
*
* @param bool $is_fastlane_eligible - Show if merchant is eligible (ACDC) but hasn't enabled Fastlane gateway.
* @param bool $is_card_payment_eligible - Show if merchant is eligible (ACDC) but hasn't enabled card button gateway.
* @param bool $is_pay_later_messaging_eligible - Show if Pay Later messaging is enabled for at least one location.
* @param bool $is_pay_later_messaging_product_eligible - Show if Pay Later is not enabled anywhere and specifically not on product page.
* @param bool $is_pay_later_messaging_cart_eligible - Show if Pay Later is not enabled anywhere and specifically not on cart.
@ -453,7 +451,6 @@ return array(
*/
return new TodosEligibilityService(
$container->get( 'axo.eligible' ) && $capabilities['acdc'] && ! $gateways['axo'], // Enable Fastlane.
$capabilities['acdc'] && ! $gateways['card-button'], // Enable Credit and Debit Cards on your checkout.
$is_pay_later_messaging_enabled_for_any_location, // Enable Pay Later messaging.
! $is_pay_later_messaging_enabled_for_any_location && ! $pay_later_statuses['product'], // Add Pay Later messaging (Product page).
! $is_pay_later_messaging_enabled_for_any_location && ! $pay_later_statuses['cart'], // Add Pay Later messaging (Cart).

View file

@ -11,7 +11,6 @@ namespace WooCommerce\PayPalCommerce\Settings\Data\Definition;
use WooCommerce\PayPalCommerce\Settings\Service\TodosEligibilityService;
use WooCommerce\PayPalCommerce\Settings\Data\GeneralSettings;
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
/**
* Class TodosDefinition
@ -35,28 +34,18 @@ class TodosDefinition {
*/
protected GeneralSettings $settings;
/**
* The subscription helper.
*
* @var SubscriptionHelper
*/
protected SubscriptionHelper $subscription_helper;
/**
* Constructor.
*
* @param TodosEligibilityService $eligibilities The todos eligibility service.
* @param GeneralSettings $settings The general settings service.
* @param SubscriptionHelper $subscription_helper The subscription helper.
*/
public function __construct(
TodosEligibilityService $eligibilities,
GeneralSettings $settings,
SubscriptionHelper $subscription_helper
GeneralSettings $settings
) {
$this->eligibilities = $eligibilities;
$this->settings = $settings;
$this->subscription_helper = $subscription_helper;
$this->eligibilities = $eligibilities;
$this->settings = $settings;
}
/**
@ -80,18 +69,6 @@ class TodosDefinition {
),
'priority' => 1,
),
'enable_credit_debit_cards' => array(
'title' => __( 'Enable Credit and Debit Cards on your checkout', 'woocommerce-paypal-payments' ),
'description' => __( 'Credit and Debit Cards is now available for Blocks checkout pages', 'woocommerce-paypal-payments' ),
'isEligible' => $eligibility_checks['enable_credit_debit_cards'],
'action' => array(
'type' => 'tab',
'tab' => 'payment_methods',
'section' => 'ppcp-card-button-gateway',
'highlight' => 'ppcp-card-button-gateway',
),
'priority' => 2,
),
'enable_pay_later_messaging' => array(
'title' => __( 'Enable Pay Later messaging', 'woocommerce-paypal-payments' ),
'description' => __( 'Show Pay Later messaging to boost conversion rate and increase cart size', 'woocommerce-paypal-payments' ),
@ -138,9 +115,7 @@ class TodosDefinition {
'isEligible' => $eligibility_checks['configure_paypal_subscription'],
'action' => array(
'type' => 'external',
'url' => $this->subscription_helper->has_subscription_products()
? admin_url( 'edit.php?post_type=product&product_type=subscription' ) // If subscription products exist, go to the subscriptions products archive page.
: admin_url( 'post-new.php?post_type=product' ), // If there are no subscriptions products, go to create one.
'url' => 'https://woocommerce.com/document/woocommerce-paypal-payments/#paypal-subscriptions',
'completeOnClick' => true,
),
'priority' => 5,

View file

@ -24,13 +24,6 @@ class TodosEligibilityService {
*/
private bool $is_fastlane_eligible;
/**
* Whether card payments are eligible.
*
* @var bool
*/
private bool $is_card_payment_eligible;
/**
* Whether Pay Later messaging is eligible.
*
@ -133,7 +126,6 @@ class TodosEligibilityService {
* Constructor.
*
* @param bool $is_fastlane_eligible Whether Fastlane is eligible.
* @param bool $is_card_payment_eligible Whether card payments are eligible.
* @param bool $is_pay_later_messaging_eligible Whether Pay Later messaging is eligible.
* @param bool $is_pay_later_messaging_product_eligible Whether Pay Later messaging for product page is eligible.
* @param bool $is_pay_later_messaging_cart_eligible Whether Pay Later messaging for cart is eligible.
@ -151,7 +143,6 @@ class TodosEligibilityService {
*/
public function __construct(
bool $is_fastlane_eligible,
bool $is_card_payment_eligible,
bool $is_pay_later_messaging_eligible,
bool $is_pay_later_messaging_product_eligible,
bool $is_pay_later_messaging_cart_eligible,
@ -168,7 +159,6 @@ class TodosEligibilityService {
bool $is_enable_google_pay_eligible
) {
$this->is_fastlane_eligible = $is_fastlane_eligible;
$this->is_card_payment_eligible = $is_card_payment_eligible;
$this->is_pay_later_messaging_eligible = $is_pay_later_messaging_eligible;
$this->is_pay_later_messaging_product_eligible = $is_pay_later_messaging_product_eligible;
$this->is_pay_later_messaging_cart_eligible = $is_pay_later_messaging_cart_eligible;
@ -193,7 +183,6 @@ class TodosEligibilityService {
public function get_eligibility_checks(): array {
return array(
'enable_fastlane' => fn() => $this->is_fastlane_eligible,
'enable_credit_debit_cards' => fn() => $this->is_card_payment_eligible,
'enable_pay_later_messaging' => fn() => $this->is_pay_later_messaging_eligible,
'add_pay_later_messaging_product_page' => fn() => $this->is_pay_later_messaging_product_eligible,
'add_pay_later_messaging_cart' => fn() => $this->is_pay_later_messaging_cart_eligible,