Add filter for credit card gateway title and description

This commit is contained in:
Emili Castells Guasch 2025-02-06 11:40:21 +01:00
parent 1810abde49
commit e5e99358bf
2 changed files with 20 additions and 2 deletions

View file

@ -394,6 +394,23 @@ class SettingsModule implements ServiceModule, ExecutableModule {
2
);
add_filter(
'woocommerce_paypal_payments_credit_card_gateway_title',
function( string $title, WC_Payment_Gateway $gateway ) {
return $gateway->get_option( 'title', $title );
},
10,
2
);
add_filter(
'woocommerce_paypal_payments_credit_card_gateway_description',
function( string $description, WC_Payment_Gateway $gateway ) {
return $gateway->get_option( 'description', $description );
},
10,
2
);
return true;
}

View file

@ -278,8 +278,9 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
'Accept debit and credit cards, and local payment methods with PayPals latest solution.',
'woocommerce-paypal-payments'
);
$this->title = $this->dcc_configuration->gateway_title();
$this->description = $this->dcc_configuration->gateway_description();
$this->title = apply_filters( 'woocommerce_paypal_payments_credit_card_gateway_title', $this->dcc_configuration->gateway_title(), $this );
$this->description = apply_filters( 'woocommerce_paypal_payments_credit_card_gateway_description', $this->dcc_configuration->gateway_description(), $this );
$this->card_icons = $card_icons;
$this->init_form_fields();