Skip to content

Instantly share code, notes, and snippets.

@amdrew amdrew/gist:6644774
Created Sep 20, 2013

What would you like to do?
Make Easy Digital Downloads' discount field show by default
* Unhook default EDD discount field
remove_action( 'edd_checkout_form_top', 'edd_discount_field', -1 );
* Custom EDD discount field function
function my_child_theme_edd_discount_field() {
if( ! isset( $_GET['payment-mode'] ) && count( edd_get_enabled_payment_gateways() ) > 1 && ! edd_is_ajax_enabled() )
return; // Only show once a payment method has been selected if ajax is disabled
if ( edd_has_active_discounts() && edd_get_cart_total() ) {
<fieldset id="edd_discount_code">
<label class="edd-label" for="edd-discount">
<?php _e( 'Discount', 'my-child-theme' ); ?>
<img src="<?php echo EDD_PLUGIN_URL; ?>assets/images/loading.gif" id="edd-discount-loader" style="display:none;"/>
<span class="edd-description"><?php _e( 'Enter a coupon code if you have one.', 'my-child-theme' ); ?></span>
<input class="edd-input" type="text" id="edd-discount" name="edd-discount" placeholder="<?php _e( 'Enter discount', 'my-child-theme' ); ?>"/>
add_action( 'edd_checkout_form_top', 'my_child_theme_edd_discount_field', -1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.