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.- Log into your WordPress admin
- Click Plugins
- Click Add New
- Search for Code Snippets
- Click Install Now under "Code Snippets"
- Activate the plugin
- Under Code Snippets, click Add New
- Paste and publish the code above
Comments
Post a Comment