I want to remove the coupon drop down feature and just have the input field and 'add coupon' button on the checkout page. Does anyone know how I can get rid of the dropdown feature? Thank you in advance!
HTML:
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! wc_coupons_enabled() ) {
return;
}
if ( ! WC()->cart->applied_coupons ) {
$info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Promo code?', 'woocommerce' ) . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>' );
wc_print_notice( $info_message, 'notice' );
}
?>
<form class="checkout_coupon" method="post" style="display:none">
<p class="form-row form-row-first">
<input type="text" name="coupon_code" class="input-text" placeholder="<?php esc_attr_e( 'Promo Code', 'woocommerce' ); ?>" id="coupon_code" value="" />
</p>
<p class="form-row form-row-last">
<input type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply', 'woocommerce' ); ?>" />
</p>
<div class="clear"></div>
</form>
I want to remove the coupon drop down feature and just have the input field and 'add coupon' button on the checkout page. Does anyone know how I can get rid of the dropdown feature? Thank you in advance!
HTML:
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! wc_coupons_enabled() ) {
return;
}
if ( ! WC()->cart->applied_coupons ) {
$info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Promo code?', 'woocommerce' ) . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>' );
wc_print_notice( $info_message, 'notice' );
}
?>
<form class="checkout_coupon" method="post" style="display:none">
<p class="form-row form-row-first">
<input type="text" name="coupon_code" class="input-text" placeholder="<?php esc_attr_e( 'Promo Code', 'woocommerce' ); ?>" id="coupon_code" value="" />
</p>
<p class="form-row form-row-last">
<input type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply', 'woocommerce' ); ?>" />
</p>
<div class="clear"></div>
</form>
Share
Improve this question
asked May 10, 2016 at 15:31
T.DoeT.Doe
1411 silver badge4 bronze badges
3
- 1 On checkout page, by default WooCommerce renders coupon field as input field and not dropdown. Not sure how you are seeing it as dropdown. Are you using any extra plugin for coupon. Please share your website link. – Prasad Nevase Commented May 10, 2016 at 16:17
- Can you leave url here, I see there is no dropdown here only 2 inputs, the text input and submit for that text. Maybe you have some javascript which is animating you this area or something? – Usce Commented May 10, 2016 at 17:54
- @ItsMePN and Usce, perhaps you're using older versions of WooCommerce? I see the animated open that the OP described. – Steven Commented May 10, 2016 at 23:16
4 Answers
Reset to default 1You can try this action. Put this line into your active theme functions.php file
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
Removing the Coupon Field Using Option
If you are really fed up with the coupons, you can easily remove the coupon field altogether. To do that, go to the WooCommerce > Settings page, click on the ‘Checkout’ tab. Uncheck the ‘Enable the use of coupons’ and click ‘Save Changes’ button. At this point, you no longer have the coupon field anywhere in your store.
You can do that with css - the form is hidden by default, but can be targeted like this:
.woocommerce-checkout form.checkout_coupon{
display:block
}
(put that in style.css)
Steven is correct, but new WooCommerce styles apply styles to that form differently now so the style code should be
.woocommerce form.checkout_coupon { display:block !important; }