Using Gravity Forms ‘gform_ppcp_card_style’ PHP filter

The gform_ppcp_card_style filter allows you to customize the appearance of the credit card inputs for the PayPal Field in the PayPal Checkout Add-On.

Usage

To apply the filter to all forms, use the following code:

add_filter('gform_ppcp_card_style', 'your_function_name', 10, 2);

Parameters

  • $card_style (array): An array of styles. Check the PayPal API documentation for supported properties. The default styles array is defined like this:
array(
    'input' => array(
        'font-size' => '1em',
    ),
    ':focus' => array(
        'color' => 'black',
    ),
)
  • $form_id (int): The ID of the form containing the PayPal Field being prepared for display.

More information

See Gravity Forms Docs: gform_ppcp_card_style

Examples

Change font size

To change the font size of the credit card input fields:

add_filter('gform_ppcp_card_style', 'ppcp_card_style_font_size', 10, 2);

function ppcp_card_style_font_size($card_style, $form_id) {
    $card_style['input']['font-size'] = '1.5em';
    return $card_style;
}

Place this code in the functions.php file of your active theme.