diff --git a/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js b/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js index fb5d17b14..ee7153c67 100644 --- a/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js +++ b/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js @@ -87,7 +87,7 @@ class CreditCardRenderer { }, expirationDate: { selector: '#ppcp-credit-card-gateway-card-expiry', - placeholder: this.defaultConfig.hosted_fields.labels.mm_yyyy, + placeholder: this.defaultConfig.hosted_fields.labels.mm_yy, } } }).then(hostedFields => { diff --git a/modules/ppcp-button/src/Assets/class-smartbutton.php b/modules/ppcp-button/src/Assets/class-smartbutton.php index c1e65bedb..1ae49ff56 100644 --- a/modules/ppcp-button/src/Assets/class-smartbutton.php +++ b/modules/ppcp-button/src/Assets/class-smartbutton.php @@ -667,7 +667,7 @@ class SmartButton implements SmartButtonInterface { 'labels' => array( 'credit_card_number' => '', 'cvv' => '', - 'mm_yyyy' => __( 'MM/YYYY', 'woocommerce-paypal-payments' ), + 'mm_yy' => __( 'MM/YY', 'woocommerce-paypal-payments' ), 'fields_not_valid' => __( 'Unfortunately, your credit card details are not valid.', 'woocommerce-paypal-payments' diff --git a/modules/ppcp-wc-gateway/src/Gateway/class-creditcardgateway.php b/modules/ppcp-wc-gateway/src/Gateway/class-creditcardgateway.php index 298b07876..d65cf126d 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/class-creditcardgateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/class-creditcardgateway.php @@ -198,6 +198,32 @@ 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 string $translation Translated text. + * @param string $text Original text to translate. + * @param string $domain 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. *