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.
Insert a few lines of PHP code to the functions.php file of your theme to achieve this.
Step 1: Open WordPress theme editor
From the WordPress Dashboard, go to Appearance > Theme Editor to open the WordPress Theme Editor screen.
Step 2: Choose functions.php
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.
- Was this article helpful?
- Yes, thanks!Not really