Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Adding CSS to woocommerce placeholder

I need help how can I add css to woocommerce field or placeholder. What I want to do is I want 2 placeholders aligned or next to each other. Just like in the picture. Pls help. Thanks

add_filter('woocommerce_billing_fields', 'custom_woocommerce_billing_fields');

function custom_woocommerce_billing_fields($fields)
{

    $fields['billing_options'] = array(
		
        'label' => __('Enter Domain:', 'woocommerce'), // Add custom field label
        'placeholder' => _x('Your custom domain here:', 'subdomain', 'woocommerce'), // Add custom field placeholder
         'custom_attributes' => 'readonly',
		'readonly' => 'readonly',
        'required' => true, 
        'clear' => false, // add clear or not
        'type' => 'text', // add field type
        'class' => array('subdomain-one')    // add class name
    );

    return $fields;
}

add_filter( 'woocommerce_billing_fields', 'custom_subdomain_field', 20, 1 );
function custom_subdomain_field( $subdomain_fields ) {
    $subdomain = 'example.com';

    $subdomain_fields['placeholder']['default'] = $subdomain;
    $subdomain_fields['placeholder']['custom_attributes']['disabled'] = 'disabled';
	
    return $subdomain_fields;
}

enter image description here

Comments