Are 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:
- Log into your WordPress site and access the Dashboard as the admin user.
- From the Dashboard menu, navigate to Marketing > Coupons and open the coupon you have created.
- Scroll down to the Coupon Data section and click on the Usage Restriction tab.
- On the Exclude product field, type the name of the product you want to exclude, as shown below:
- This is the outcome:
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
- How to Force Maximum 1 Category Per Product WooCommerce
- How to Get Order Details After Checkout In WooCommerce
- How to Create WooCommerce Add to Cart Button by Product Id
- How to Create WooCommerce Conditional Checkout Fields
- How to Get Product Description & Display WooCommerce
- How to Add Custom Meta Box To WooCommerce Product
- How to Add WooCommerce Registration Email Verification
- How to Get Current WooCommerce Product Category
- How to Set WooCommerce Different Sidebar For Each Category
- How Get Product ID on Checkout Page Or Order Page In WooCommerce
- How to Add CAPTCHA WooCommerce Login
- How to Move WooCommerce Products To New Site
- How to Add Custom Background For WooCommerce
- How to Add Information to the WooCommerce Shop Page
- Wix vs WordPress Complete Comparison » [Features, Pros & Cons]
- How to Upload Image On Product Page In WooCommerce
- What is the Best Payment Gateway for WooCommerce
- How to Use WooCommerce to Set Up Online Store
- How to Display Category Name in WordPress Using a Practical Example
- How to Get Order ID on Checkout Page WooCommerce