Hide Coupon Code Field

If your marketplace does not require a coupon functionality or you do not want your user to apply any coupon code then hide the field from everywhere (Cart/Checkout). Now, you can say that “I am not a developer/programmer, how can I do this?”. Please follow my below instruction to do this customization easily and in the proper way.

How Can You Hide The Field : 
Always try to customize the plugin functionality through a child theme and try to use action/filter to override/extend a functionality. Because overriding through child theme is safe. Otherwise, you can loose your customization during the plugin update.
For this simple customization, I am gonna use the filter- “woocommerce_coupons_enabled”. I will create a new function (my own function) and I will write my condition as well. I know you are not an expert so, Here is the code for you-
function remove_coupon( $enabled ) {
if ( is_cart() || is_checkout() ) {
$enabled = false;
return $enabled;
add_filter( ‘woocommerce_coupons_enabled’, ‘remove_coupon’ );
Now, Just paste those lines into your child theme’s function.php file and reload your website. Then you will see there is no field to apply the coupon code.

You can also change the word "Apply Coupon". Keep following my blog to get the next tuotorial.


Share This Post

Related Post

Be the first to reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: