Skip to content

Instantly share code, notes, and snippets.

@pippinsplugins
Created June 25, 2013 20:09
Show Gist options
  • Save pippinsplugins/5861915 to your computer and use it in GitHub Desktop.
Save pippinsplugins/5861915 to your computer and use it in GitHub Desktop.
Replace EDD country / state drop downs with plain text fields.
<?php
function pw_edd_remove_default_fields() {
remove_action( 'edd_after_cc_fields', 'edd_default_cc_address_fields' );
}
add_action( 'init', 'pw_edd_remove_default_fields' );
function pw_edd_custom_country_fields() {
ob_start(); ?>
<fieldset id="edd_cc_address" class="cc-address">
<legend><?php _e( 'Billing Details', 'edd' ); ?></legend>
<?php do_action( 'edd_cc_billing_top' ); ?>
<p id="edd-card-address-wrap">
<label class="edd-label"><?php _e( 'Billing Address', 'edd' ); ?></label>
<span class="edd-description"><?php _e( 'The primary billing address for your credit card.', 'edd' ); ?></span>
<input type="text" name="card_address" class="card-address edd-input required" placeholder="<?php _e( 'Address line 1', 'edd' ); ?>"/>
</p>
<p id="edd-card-address-2-wrap">
<label class="edd-label"><?php _e( 'Billing Address Line 2 (optional)', 'edd' ); ?></label>
<span class="edd-description"><?php _e( 'The suite, apt no, PO box, etc, associated with your billing address.', 'edd' ); ?></span>
<input type="text" name="card_address_2" class="card-address-2 edd-input" placeholder="<?php _e( 'Address line 2', 'edd' ); ?>"/>
</p>
<p id="edd-card-city-wrap">
<label class="edd-label"><?php _e( 'Billing City', 'edd' ); ?></label>
<span class="edd-description"><?php _e( 'The city for your billing address.', 'edd' ); ?></span>
<input type="text" name="card_city" class="card-city edd-input required" placeholder="<?php _e( 'City', 'edd' ); ?>"/>
</p>
<p id="edd-card-country-wrap">
<label class="edd-label"><?php _e( 'Billing Country', 'edd' ); ?></label>
<span class="edd-description"><?php _e( 'The country for your billing address.', 'edd' ); ?></span>
<input name="billing_country" id="billing_country" type="text" class="billing_country edd-input required">
</p>
<p id="edd-card-state-wrap">
<label class="edd-label"><?php _e( 'Billing State / Province', 'edd' ); ?></label>
<span class="edd-description"><?php _e( 'The state or province for your billing address.', 'edd' ); ?></span>
<input type="text" size="6" name="card_state" id="card_state" class="card_state edd-input" placeholder="<?php _e( 'State / Province', 'edd' ); ?>"/>
</p>
<p id="edd-card-zip-wrap">
<label class="edd-label"><?php _e( 'Billing Zip / Postal Code', 'edd' ); ?></label>
<span class="edd-description"><?php _e( 'The zip or postal code for your billing address.', 'edd' ); ?></span>
<input type="text" size="4" name="card_zip" class="card-zip edd-input required" placeholder="<?php _e( 'Zip / Postal code', 'edd' ); ?>"/>
</p>
<?php do_action( 'edd_cc_billing_bottom' ); ?>
</fieldset>
<?php
echo ob_get_clean();
}
add_action( 'edd_after_cc_fields', 'pw_edd_custom_country_fields' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment