Move Coupon Form Under “Proceed to Checkout”

If we want to display a brand new coupon form under the “Proceed to Checkout” button on the Cart page. This is easily done by using the correct hook (“woocommerce_proceed_to_checkout”) and by printing the HTML code for the form.

add_action( 'woocommerce_proceed_to_checkout', 'codeithub_display_coupon_form_below_proceed_checkout', 25 );
function codeithub_display_coupon_form_below_proceed_checkout() {
      <form class="woocommerce-coupon-form" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
         <?php if ( wc_coupons_enabled() ) { ?>
            <div class="coupon under-proceed">
               <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" style="width: 100%" /> 
               <button type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>" style="width: 100%"><?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?></button>
         <?php } ?>


See also  How to Remove the Additional Information and Order Notes fields WooCommerce
Default Cart Page


Coupon Form under Checkout

Leave a Reply

Your email address will not be published. Required fields are marked *