### [How to Change Sub-labels for the Stripe Credit Card Field](https://wpforms.com/developers/how-to-change-sublabels-for-the-credit-card-field/)

**Published:** February 7, 2020
**Author:** Editorial Team

**Excerpt:** This tutorial will show you how to change sub-labels on a Credit Card form field using PHP. 

**Content:**

## Introduction

Would you like to change sub-labels on your form **Stripe Credit Card** fields? You can change the sub-labels that appear below the fields on your form. In this tutorial, we’ll show you the basics of how you can change the sub-labels on the **Stripe Credit Card** field using a PHP code snippet.

In WPForms, the **Stripe Credit Card** field displays two different fields:

- Card Number
- Name on Card

## Saving the Stripe Settings

Before we create our form, we’ll need to enable a setting under the **Payments** tab of WPForms settings. You can find this setting by navigating to **WPForms Settings » Payments**. Under the **Stripe** heading, select **Card Element** for the **Credit Card Field Mode**.

This tutorial will only work if you use the **Card Element**. If you have selected the **Payment Element**, this snippet will not work for you. **Payment Elements** are loaded on the page through an iFrame and these sub-labels cannot be changed from an iframe.

![enable the Card Element for your Stripe processing](https://wpforms.com/wp-content/uploads/2020/02/wpforms-stripe-card-element.jpg)

## Creating the form

Next, you’ll need to set up a form that has a **Stripe Credit Card** field. If you need any help in creating a form that would accept Stripe payments, [please see this documentation](https://wpforms.com/docs/how-to-install-and-use-the-stripe-addon-with-wpforms/ "How to Install and Use the Stripe Addon with WPForms").

![create a form that will accept Stripe credit card payments](https://wpforms.com/wp-content/uploads/2020/02/stripe-credit-card-form.jpg)

## Adding the snippet to change the sub-labels

To change the sub-labels you’ll need to add this snippet to your site. If you need any help in adding snippets to your site, [please see this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/**
 * Customize Stripe credit card field properties.
 *
 * @link https://wpforms.com/developers/how-to-change-sublabels-for-the-credit-card-field
 */
 
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 );

```

Please note that the below code snippet will only change the sub-labels on the **Stripe Credit Card** field.

![using this snippet you can now change sub-labels on credit card fields for Stripe](https://wpforms.com/wp-content/uploads/2020/02/wpforms-change-credit-card-sublabels.jpg)

And that’s it! You’ve now successfully changed the sub-labels. Would you like to change the sub-labels of the **Name** field? Take a look at our article on [How to Change Sub-labels for the Name Field](https://wpforms.com/developers/how-to-change-sublabels-for-the-name-field/ "How to Change Sub-labels for the Name Field").

## Related

Filter Reference: [wpforms\_field\_properties](https://wpforms.com/developers/wpforms_field_properties/ "Using the wpforms_field_properties filter")

**Categories:** Tutorials

**Tags:** PHP

---

