Home / Admin / Change Sublabels for the Stripe Credit Card Field
Duplicate Snippet

Embed Snippet on Your Site

Change Sublabels for the Stripe Credit Card Field

With this snippet you can change the sublabels that appear on the Stripe Credit Card field when you have the Card Element selected from the WPForms Settings >> Payments >> Stripe.

<10
Code Preview
php
<?php
/**
 * Customize Stripe credit card field properties.
 *
 * @link https://wpforms.com/developers/how-to-change-sublabels-for-the-credit-card-field
 * 
 * For support, please visit: https://www.facebook.com/groups/wpformsvip
 */
  
function wpf_dev_creditcard_field_properties( $properties, $field, $form_data ) {
       
    // Change sub-label text on the Card Number field
    $properties[ 'inputs' ][ 'number' ][ 'sublabel' ][ 'value' ] = __( 'Enter your card number', 'text-domain' );
   
    // Change sub-label text on the Card Name field
    $properties[ 'inputs' ][ 'name' ][ 'sublabel' ][ 'value' ] = __( 'Name as it appears on the card', 'text-domain' );
       
    return $properties;
}
   
add_filter( 'wpforms_field_properties_stripe-credit-card' , 'wpf_dev_creditcard_field_properties', 10, 3 );

Comments

Add a Comment