Merge pull request #2651 from woocommerce/PCP-3736-translations-no-longer-applied-to-card-fields-in-2-9-0

Add Custom Placeholder Handling when rendering the card fields (3736)
This commit is contained in:
Emili Castells 2024-10-04 15:16:27 +02:00 committed by GitHub
commit 1325779582
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,11 +8,17 @@ function renderField( cardField, inputField ) {
// Insert the PayPal card field after the original input field.
const styles = cardFieldStyles( inputField );
cardField( { style: { input: styles } } ).render( inputField.parentNode );
const fieldOptions = {style: { input: styles },};
// Hide the original input field.
hide( inputField, true );
inputField.hidden = true;
if ( inputField.getAttribute( 'placeholder' ) ) {
fieldOptions.placeholder = inputField.getAttribute( 'placeholder' );
}
cardField( fieldOptions ).render( inputField.parentNode );
// Hide the original input field.
hide( inputField, true );
inputField.hidden = true;
}
export function renderFields( cardFields ) {