Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Hide the WooCommerce Coupon code field

Offering coupons to the customers on the WooCommerce store is a great way to offer rewards or discounts.

But, sometimes customers get used to the coupon codes in such a way that they continuously look whether any coupons are been offered on the store. Which may result in customers waiting until the offers are offered at the stored or search for the competitor’s plugin or find any coupon code offered from the affiliates. Which in turn would affect the sales on the store.

We shall take a look at three different ways to hide the coupon code which are as follows:

1) Disable coupon code completely on your WooCommerce store.
2) Hide on the cart page and display on the checkout page.
3) Hide on the checkout page and display on the cart page.

Incase you want to hide the coupon code field based on specific products or product categories, we’ve written about it it extensively here.

1) Disable coupon code completely on your WooCommerce store

The store owner can disable the coupon code field completely on the cart and the checkout page, if they do not want to offer any rewards or offers on the store by disabling the ‘Enable the use of coupon codes’ checkbox in the WooCommerce->Settings->General tab.

Here is the screenshot of the setting:
How to Hide the WooCommerce Coupon code field - Tyche Softwares

2) Hide the coupon code field on the WooCommerce Cart page

If the store owner wants to hide the coupon code field only on the cart page and display it on the checkout page then the below code snippet can be used to achieve this requirement.

The below code snippet is to be placed in the functions.php file of the currently active child theme (if exists) or in the parent theme.

3) Hide the coupon code field on the WooCommerce Checkout page

Sometimes store owners want to hide the coupon code field only on the checkout page and display it on the cart page. This requirement can be achieved by placing the below code snippet in the functions.php file of the currently active child theme (if exists) or in the parent theme.

Following one of the above three methods, the store owner can hide/disable the coupon code field on the cart page and/or on the checkout page.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
2 Comments
Newest
Oldest
Inline Feedbacks
View all comments
mamaligadoc
3 years ago

With respect !!!

Alvina
5 years ago

Thank you for sharing this tutorial. I am having an error while adding coupon code as my code is not working. I have seen this code in this tutorial https://www.cloudways.com/blog/create-woocommerce-coupon-code/ and I have almost implemented the same. When I am adding coupon it’s saying not valid. Please let me know what is the issue? add_action( ‘woocommerce_before_cart’, ‘sh_coupons_matched’ ); function sh_coupons_matched() { global $woocommerce; $sh_coupon = ‘OnlineShop’; if ( $woocommerce->cart->has_discount( $sh_coupon ) ) return; foreach ( $woocommerce->cart->cart_contents as $key => $values ) { $autocoupon = array( 65 ); if( in_array( $values[‘product_id’], $autocoupon ) ) { $woocommerce->cart->add_discount( $cw_coupon ); wc_print_notices(); } }… Read more »

2
0
Would love your thoughts, please comment.x
()
x