Home > Docs > Smart Coupons for WooCommerce > Hide Coupon Code Field From WooCommerce Checkout Page or Cart page

Hide Coupon Code Field From WooCommerce Checkout Page or Cart page

Last updated on September 11, 2024

This article shows a shortcut to hide the coupon code field from your cart and checkout pages.

  1. Navigate to the Theme file editor.
  2. Access the function.php file.
  3. Copy the code snippet given below.
  4. Paste the code into the function.php file.
  5. Save changes.

Step 1: Access the 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

You can see the list of files in your active theme folder on the Theme Editor screen. Please scroll down 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, copy either of the two PHP code snippets below.

PHP code to disable the coupon code field on the cart page

PHP code to disable the coupon code field on 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.