Woocommerce: Hide Coupon Field on the CART

The following code snippet shows how to hide the coupon field on Cart page in Woocommerce.

Code


add_filter( 'woocommerce_coupons_enabled', 'hp_hide_coupon_field_on_cart' );

function hp_hide_coupon_field_on_cart( $enabled ) {

	if ( is_cart() ) {
		$enabled = false;
	}

	return $enabled;
}

Where to add this Code snippet?

Usually, the code is added in functions.php of your child theme. As shown below:

/path/to/wordpress/wp-content/themes/mytheme-child/functions.php

I don't have access to this functions.php

As an alternative, you can also install and use a plugin called Code Snippets from the admin.
  1. Log into your WordPress admin
  2. Click Plugins
  3. Click Add New
  4. Search for Code Snippets
  5. Click Install Now under "Code Snippets"
  6. Activate the plugin
  7. Under Code Snippets, click Add New
  8. Paste and publish the code above

Comments