How to Add Product Discounts in WooCommerce
We all know almost all online shoppers hunt for discounts and coupons before making any purchase. What’s more important is you can recover or prevent 87% of shoppers from abandoning your cart through discounts.
Do you have any idea how much discounts can save store owners like you in total in a year?
A jaw-dropping $3.48 trillion!
You read it right: discounts could potentially save $3.48 trillion annually in abandoned cart revenue if done right. And the best platform to offer discounts is undoubtedly WooCommerce.
So, if you are wondering how to create discounts for my products in WooCommerce, you are in the right place.
In this article, we will walk you through the steps to creating WooCommerce product discount rules using all available methods.
Let’s dive in.
How to Setup WooCommerce Product Discount?
There are 3 possible methods through which you can set up a WooCommerce product discount.
- Using a Discount Plugin
- Using the Coupon Tool
- Using Custom Codes
Among these, the most advanced, feature-rich, and flexible way of adding WooCommerce discount per product is by using a dedicated discount plugin. Discount plugins offer a wide range of functionalities that allow you to apply targeted and dynamic discounts effortlessly.
One excellent option is Disco, a powerful discount plugin designed specifically for WooCommerce. Disco enables you to create advanced discount rules, such as product-specific discounts, tiered pricing, or even category-based promotions. Its user-friendly interface ensures that you can set up discounts without any technical expertise.
Whether you’re looking to boost sales, reward loyal customers, or encourage bulk purchases, Disco makes the process seamless and effective. Let’s explore how to add discount in WooCommerce product using Disco.
We are creating a discount rule where you – Offer 15% off on all products in your WooCommerce store. Here are the steps:
Step 1: Install the Discount Plugin – Disco
- Log in to your WordPress dashboard.
- Navigate to Plugins >> Add New and search for Disco.
- Click Install Now, then Activate the plugin.
- Once activated, Disco will add a dedicated menu to your WordPress admin panel.
Step 2: Create a New Discount Rule
Go to the Disco menu in your WordPress dashboard and click the Create a Discount button. This will open the discount creation window.
Step 3: Configure the Discount Rule
- Enter a name for your discount rule, such as “15% Storewide Discount.”
- Select Product as the Discount Intent to apply the discount to products.
Step 4: Apply Discount to All Products
Under the Discount section, choose All Products to apply the discount sitewide.
Step 5: Set Validity (Optional)
- If you want the discount to be valid for a specific time, set the Start Date and End Date fields from the Valid Between section.
- Leave these fields blank if you want the discount to remain active indefinitely.
Step 6: Configure Discount Type and value
Under Product Rules, select the Percentage option and enter 15 as the value, as you can see below.
Step 7: Save the Discount Rule
- Click the Save button to finalize your WooCommerce discount all products rule.
Step 8: Verify on the Frontend
- Visit your WooCommerce store to ensure the discount is applied.
- Check that all product prices reflect the 15% discount.
- Add a product to the cart to see the discount applied to the cart total, along with the savings displayed for the customer.
That’s it! You’ve successfully created a 15% storewide WooCommerce product discount in WooCommerce.
Exploring Different WooCommerce Product Discount Strategies with Disco
Disco allows you to implement various product discount strategies that cater to different business needs. Below are some effective discount strategies you can set up using the plugin, along with examples for each:
How to Setup Fixed Amount Discounts for Specific Products
Example: Apply a $10 discount on the “Magic Moments Tee” product.
WooCommerce fixed product discounts are great for highlighting and driving sales for high-value or surplus inventory items. Here’s how you can set it up.
Enter your discount name and select the Product intent.
Under Discount, select the Few Products filter.
Type in or search and select the “Magic Moments Tee” product.
Select the Fixed option and enter the value.
Save the rule, and now, if you visit the selected product’s page, you will see the system has already applied the discount.
How to Create Bulk Purchase WooCommerce Product Discount?
Example: Get 10% off on orders of 3-5 quantities.
WooCommerce bulk discounts encourage customers to buy more by offering discounts for higher quantities. Here are the steps –
This time, you need to select the Bulk option from the top.
Specify your products and jump to the Bulk Rules section to set bulk discount rules.
Set 3 as the Minimum Quantity and 5 as the Maximum Quantity. Select the percentage option and enter the value.
After saving the rule, add 3-5 products to the cart, and it will apply a 10% WooCommerce discount multiple products automatically.
How to Setup Cart-Based WooCommerce Product Discount?
Example: Offer a $15 discount when the cart total exceeds $100.
WooCommerce cart discounts encourage customers to spend more by rewarding higher-value purchases. In this example, we will introduce Disco conditions.
Conditions are what make it possible to offer advanced, dynamic, and personalized discounts to your customers. They define the rules that determine when a discount should apply.
For instance, you can use conditions to:
- Apply discounts based on cart value, product quantities, or customer roles.
- Target specific products, categories, or tags.
- Set location-based conditions for discounts to activate when customers from target locations add something to the cart.
These conditions allow you to create highly tailored Woo conditional discounts to suit various customer behaviors and promotional strategies. Let’s get back to setting up cart discounts.
Select the Cart intent and specify your products.
Set your value from the Cart Rules section and then click the Add Condition button.
Select the Cart Subtotal from the filter dropdown.
As we are offering a discount on a cart total equivalent to 100 or even more, select the Greater Than Or Equal option and type in your value.
Add $100 or more worth of products to the cart to test the WooCommerce product discount rule.
How to Create Category-Specific WooCommerce Product Discount?
Example: Offer 25% off on all products in the “Summer Collection” category.
WooCommerce category discounts can drive targeted traffic and sales for specific product categories. Here’s how you set it up.
Select the Product intent and select All Products, as we are offering discounts on all products under that category.
Set the percentage and add the Categories condition.
Type and select the target category.
Checkout the “Summer Collection” category page as it should already be showing the discounted rates.
How to Offer User Role-Based WooCommerce Product Discount?
Example: Gold members receive a flat $20 discount on every purchase.
WooCommerce user role discounts help create loyalty programs by offering exclusive discounts to specific user roles. These are particularly helpful if you offer subscription plans on your Woo membership site.
Start by selecting the intent and products. After that, set the value.
Add the condition “User Role” from the filters.
Scroll or type and select the target membership.
Now, your Gold members can enjoy $20 on their subsequent purchases.
How to Setup Product Discounts Using Coupon Tool?
Creating a WooCommerce product discount using the coupon tool is quick and simple. Follow these steps to set it up:
Step 1: Open the Coupon Tool
- In your WordPress dashboard, go to Marketing >> Coupons.
- Click Add Coupon to create a new discount.
Step 2: Enter the Coupon Code
Add a unique coupon code, such as SAVE10, that customers will use during checkout.
Step 3: Define the Discount
- In the Discount Type field, choose:
- Percentage Discount for a percentage-based discount (e.g., 10% off).
- Fixed Product Discount for a fixed amount off specific products.
- Enter the discount value (e.g., 10 for 10% or $10).
Step 4: Optional Settings
Add a Coupon Expiry Date if the coupon is for a limited time.
- Use the Usage Restrictions tab to:
- Specify eligible products or categories.
- Set minimum or maximum cart values.
Step 5: Activate the Coupon
Click Publish to save and activate the coupon.
Step 6: Test Your Coupon
Go to your store, add the eligible products to the cart, and enter the coupon code at checkout to ensure it works as expected.
That’s it! This is an easy way to encourage sales of specific products. You can also fine-tune restrictions or stack them with other promotional strategies for added impact.
How to Setup WooCommerce Product Discount Using Custom Codes?
Creating a WooCommerce product discount using a custom code can give you greater flexibility. Here’s a step-by-step guide to help you set it up in simple terms:
Step-by-Step Process of Creating WooCommerce Product Discount Using Codes
Step 1: Backup Your Website
Before making any changes, create a full backup of your WordPress site. This ensures that you can restore it if anything goes wrong.
Step 2: Access the Theme Files
- Log in to your WordPress dashboard.
- Navigate to Appearance >> Theme File Editor.
- Select the active theme’s functions.php file.
Step 3: Add the Custom Code
Add the following PHP code snippet to your functions.php file. This example applies a 10% discount on a specific product (replace 123 with your product’s ID):
add_action('woocommerce_cart_calculate_fees', 'custom_fadi_product_discount', 10, 1);
function custom_fadi_product_discount($cart) {
if (is_admin() || defined('DOING_AJAX')) {
return;
}
$target_product_id = 123; // Replace with your product ID
$discount_percentage = 10; // Discount percentage
foreach ($cart->get_cart() as $cart_item) {
if ($cart_item['product_id'] == $target_product_id) {
$discount = ($cart_item['line_total'] * $discount_percentage) / 100;
$cart->add_fee(__('Product Discount', 'woocommerce'), -$discount);
break;
}
}
}
Step 4: Collect and Replace Product ID
To collect a product’s ID, go to Products >> All Products and hover over your target product. It will show the ID. Replace this ID in your code.
Step 5: Save and Test the Discount
- Click Update File to save the changes.
- Add the specific product to the cart.
- Go to the cart or checkout page to ensure the discount is applied correctly.
Step 6: Troubleshoot and Refine
- If the discount doesn’t show, check your product ID and ensure the code is placed correctly.
- You can modify the percentage or apply different logic, such as cart totals or user roles, by tweaking the code.
Notes:
- For more complex rules, consider using plugins like Code Snippets to manage custom code safely.
- Avoid editing theme files directly if you use automatic theme updates; create a child theme or use a plugin for custom functions.
This approach is flexible and suitable for developers or those comfortable with minor coding adjustments.
Creating BOGO Product Discounts Using Custom Codes
Creating a “Buy One, Get One Free” (BOGO) or “Buy One, Get the Second at 50% Off” offer in WooCommerce using custom code can be done with the following steps:
Step 1: Backup Your Website
Always back up your WordPress site before making any code changes. This ensures you can restore it if anything goes wrong.
Step 2: Access Your Theme Files
- Log in to your WordPress admin panel.
- Go to Appearance >> Theme File Editor.
- Open the functions.php file of your active theme.
Step 3: Add the Custom Code
Insert the following PHP code to create the WooCommerce discount second product offer. Adjust product IDs and discount logic as needed:
Example for “Buy Two, Get Second One Free”
add_action( 'woocommerce_before_calculate_totals', 'bogo_fadiapply_discount', 20 );
function bogo_fadiapply_discount( $cart ) {
if ( is_admin() || ! did_action( 'woocommerce_before_calculate_totals' ) ) {
return;
}
$target_product_id = 123; // Replace with the product ID for the BOGO deal.
foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) {
if ( $cart_item['product_id'] == $target_product_id ) {
$quantity = $cart_item['quantity'];
if ( $quantity >= 2 ) {
// Number of items eligible for free.
$free_items = floor( $quantity / 2 );
// Set effective price for the product to reflect the BOGO discount.
$regular_price = $cart_item['data']->get_regular_price();
$discounted_price = $regular_price * ($quantity - $free_items) / $quantity;
$cart_item['data']->set_price( $discounted_price );
}
}
}
}
Example for “Buy One, Get Second at 50% Off”
Here’s how to add 2nd discount on WooCommerce products using codes. Copy the following code to your functions.php file.
add_action('woocommerce_cart_calculate_fees', 'bogo_50_discount', 10, 1);
function bogo_50_discount($cart) {
if (is_admin() || defined('DOING_AJAX')) {
return;
}
$product_id = 123; // Replace with the product ID
$discount_name = __('BOGO 50% Off Discount', 'woocommerce');
$cart_items = $cart->get_cart();
foreach ($cart_items as $item) {
if ($item['product_id'] == $product_id && $item['quantity'] >= 2) {
$discount = ($item['line_total'] / $item['quantity']) * 0.5; // 50% of one product price
$cart->add_fee($discount_name, -$discount);
break;
}
}
}
Step 4: Save the File
Click Update File to save your changes.
Step 5: Test Your Offer
- Add the specified product to your cart.
- Adjust the quantity to 2 or more.
- Check if the discount is applied correctly in the cart or checkout.
Result for buy two and get the second one free.
Here’s the result for Buy one and get the second one at 50%
Notes:
- Replace 123 with the product ID you want to apply the discount to.
- Modify the code logic for specific variations, categories, or cart conditions if needed.
- For safer management, consider using the Code Snippets plugin instead of editing theme files directly.
By using this code, you can create enticing promotions like BOGO offers to boost sales.
Wrap up
Offering WooCommerce product rules is a powerful way to drive sales and increase customer engagement. Discounts encourage customers to make purchases, which helps reduce cart abandonment rates and boost average order values.
They also create a sense of urgency, especially when paired with limited-time offers, motivating customers to buy sooner. In addition, product discounts allow you to clear out old stock, promote specific products, or reward loyal customers.
These strategies not only enhance customer satisfaction but also strengthen brand loyalty, giving you a competitive edge in the market. Hope this article will guide you to effectively set up product discount rules in your WooCommerce store.