Disabling coupon codes will remove the coupon code field completely from the WooCommerce store. Therefore, customers won’t be able to see the coupon code field on the checkout page and the cart page.
However, you can hide the coupon code field from the cart or checkout page and make it visible on other pages of the store. To achieve this:
- Navigate to the Theme file editor.
- Access the function.php file.
- Copy the code snippet given below.
- Paste the code into the function.php file.
- Save changes.
Step 1: Access WordPress theme file editor
From the WordPress Dashboard, navigate to Appearance > Theme Editor to open the WordPress Theme Editor screen.
Step 2: Open functions.php file
In the Theme Editor screen, you can see the list of files in your active theme’s folder. Scroll down through the list and click on the Theme Functions (functions.php) file to open it in the text editor screen.
Step 3: Copy the PHP code
Depending on which page you want to disable the coupon code field, you can copy either of the two PHP code snippets given below.
PHP code to disable coupon code field in the cart page
PHP code to disable coupon code field in the checkout page
Step 4: Add the PHP code to functions.php
In the WordPress Theme Editor screen, scroll down to the bottom of the functions.php file and paste the code at the end.
Step 5: Update code
Click on the Update file button to save the code.