How to remove the coupon field on the cart page?

I’ve been attempting to remove the coupon field from the cart page of our site (would like it to remain on the checkout page), but haven’t been able to do so successfully. I tried some of the scripts to add to the functions.php file I found while searching google, but none of them seem to work properly.

Does anyone have any suggestions?

Hello @digitalinkwebdesign,

Thanks for writing in!

Please add following Php code in child theme function.php file to remove coupon field from cart page:

// hide coupon field on cart page

function hide_coupon_field_on_cart( $enabled ) {
  if ( is_cart() ) {
    $enabled = false;
  }
  return $enabled;
}

add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_cart' );

Please use following link to download child theme:

To setup child theme kindly refer following tutorial:

Let us know how it goes.

Thanks.

Hi Prasant,

Thanks for the prompt reply.

That did the trick!

Is there a specific script to relocate the coupon field on the checkout page? I would like to place it at the bottom of the page, following the payment method.

Hello @digitalinkwebdesign,

Thanks for writing in! Just as a quick follow up to this, you can also disable coupons altogether by going to WooCommerce > Settings > Checkout in the WordPress admin and finding the Coupons section, where there is a Enable the use of coupons checkbox that you can disable. This setting will allow coupons to be applied from the cart and checkout pages, and this will work without needing any custom code.

Regarding moving coupon functionality, make sure to read up on our article that details how to overwrite views in the Knowledge Base. This will give you the overview you need to start changing functionality via a child theme as you need it. Essentially, you’ll need to find the bit of markup or functionality you want to move, and then locate the view or filter that will allow you to output it where you need. Sometimes this requires a complete overwrite of a view or template in the child theme (which we only recommend when absolutely necessary), or you may be able to do so via WordPress actions and filters. Then it’s simply a matter of tying it all together by finding the proper WooCommerce functionality you need and plugging it in where you need it to go.

That should help to point you in the right direction, cheers!