mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
replace WC CVV field label
This commit is contained in:
parent
dfe4acb122
commit
9fd1822c0f
1 changed files with 28 additions and 0 deletions
|
@ -197,6 +197,34 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the credit card fields.
|
||||
*/
|
||||
public function form()
|
||||
{
|
||||
add_action('gettext', array($this, 'replace_credit_card_cvv_label'), 10, 3);
|
||||
parent::form();
|
||||
remove_action('gettext', 'replace_credit_card_cvv_label');
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace WooCommerce credit card field label.
|
||||
*
|
||||
* @param $translation string Translated text.
|
||||
* @param $text string Original text to translate.
|
||||
* @param $domain string Text domain.
|
||||
*
|
||||
* @return string Translated field.
|
||||
*/
|
||||
public function replace_credit_card_cvv_label(string $translation, string $text, string $domain): string
|
||||
{
|
||||
if('woocommerce' !== $domain || 'Card code' !== $text) {
|
||||
return $translation;
|
||||
}
|
||||
|
||||
return __('CVV', 'woocommerce-paypal-payments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the gateway.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue