How to Exclude Product From Discount Coupons WooCommerce

WooCommerce Exclude Product From Discount CouponsAre you looking for a quick and easy way to exclude a specific product from discount coupons in your WooCommerce store? Then read on, as we will help you by providing a simple solution for you. We specifically made a code snippet to solve this problem. If you are a beginner, we will try to explain each step in detail, so that you do not have a hard time.

Many online stores use coupons today. This is because they are a tried and tested marketing strategy that has helped many businesses to attract customers. In addition, it is a great way to sell off stock if you want to occupy the retail space.

It is important to note that WooCommerce offers basic features for setting up and managing coupons. In addition, you still have the option of using extensions for a more extensive coupon strategy.

However, it is worth mentioning that plugins bloat your site. This is why you should use them only when you need them. This is why we will use custom code snippets in this tutorial to get the desired result.

WooCommerce Exclude Product From Discount Coupons

In this brief guide, we will show you how to exclude a specific product ID from discount coupons. To achieve this, we will edit some of WooCommerce’s core files. This means that you need to create or install a child theme to ensure your changes are not lost during an update.

With that in mind, let us get right into it.

Steps to Exclude Product From Discount Coupons

Here are the simple steps you need to follow:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, navigate to Marketing > Coupons and open the coupon you have created.
  3. Scroll down to the Coupon Data section and click on the Usage Restriction tab.
  4. On the Exclude product field, type the name of the product you want to exclude, as shown below:exclude
  5. This is the outcome:coupon error

Wrapping Up

That is all you need to do to exclude a specific product ID from a discount coupon. We have used the woocommerce_coupon_is_valid_for_product to make it invalid for a specific product ID. Remember to use the correct product ID for this solution to work.

In addition, you should be very careful when editing the functions file of your theme. If you make any mistake, a critical error will be displayed on your site.

If you need any custom work, feel free to contact us.

Similar Articles