FunnelKit
FunnelKit Documentation
Get unstuck with our helpful reference material

Update Stripe Fields To Support Dark Mode Appearance

In this documentation, we’ll show you how to update Stripe fields to support a dark mode appearance.

To achieve this, follow these steps:

Step 1: Add the custom code nnippet

Add the code snippet below to update the Stripe fields and enable dark mode appearance

Note: You can add this snippet using a plugin like “Code Snippets” to avoid directly editing theme or plugin files. To learn the process, refer to our doc on “how to add a custom snippet to WordPress”.

/**
* Allow the code to alter payment element data, in this case modifying the theme of the payment element
**/
add_filter( 'fkwcs_stripe_payment_element_data', 'modify_stripe_payment_element_theme', 10, 2 );

function modify_stripe_payment_element_theme( $data, $gateway ) {
    // Check if this is the credit card gateway
    if ( $gateway->id === 'fkwcs_stripe' ) {
        // Modify the theme to 'night'
        if ( isset( $data['element_data']['appearance'] ) ) {
            $data['element_data']['appearance']['theme'] = 'night';
        }
    }

    return $data;
}
Update Stripe Fields To Support Dark Mode Appearance

Step 2: Test Stripe dark mode appearance

After adding the snippet, place a test order to confirm that the Stripe fields display correctly in dark mode.

preview Update Stripe Fields To Support Dark Mode Appearance
Ready to Transform Your Store?
Join 39,415+ successful store owners who trust FunnelKit to power their businesses.
Conversion Optimized Checkout Pages
Increase Revenue with Smart Upsells
Capture Emails & Recover Abandoned Carts
Automate Winbacks & Repeat Sales
941+ 5 star reviews on WordPress.org
Transform your store to power your business with FunnelKit
🚀 Maximize Your Profit with FunnelKit – Highest Rated with 941+ 5-Star Reviews
Get Started