Home > Docs > Smart Coupons for WooCommerce > How to Set Up a WooCommerce Buy One Get One Free Offer

How to Set Up a WooCommerce Buy One Get One Free Offer

Last updated on April 24, 2026

This article shows a shortcut to hide coupon field in WooCommerce Checkout & Cart 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: Open the WordPress Theme Editor

From the WordPress Dashboard, navigate to Appearance > Theme Editor to open the WordPress Theme Editor screen.

Step 2: Open the 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 Hide Coupon Field in WooCommerce Cart

PHP Code to Hide Coupon Field in WooCommerce Checkout

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 to hide the coupon field on WooCommerce Checkout & Cart pages. Alternatively, you can use a third-party plugin to add the code snippet. To learn more, check out this article: Add Code Snippets Using Third-Party Plugins.

Step 5: Update code

Click on the Update file button to save the code.

Final Result: Before and After

  1. Cart Page
Cart page before and after adding the code snippet
Cart page before and after adding the code snippet
  1. Checkout page
Checkout page before and after adding the code snippet
Checkout page before and after adding the code snippet

You can hide the WooCommerce coupon field on the cart or checkout page by adding a small PHP snippet to your functions.php file. Use is_cart() to disable it on the cart page and is_checkout() for checkout. Always use a child theme or code snippets plugin to prevent losing changes during updates.