Setup WooCommerce Percentage Discount

How to Setup WooCommerce Percentage Discount (Easy Guide)

The world of online shopping, aka eCommerce, is booming. In 2023, approximately 2.64 billion online shoppers purchased a whopping 6+ trillion USD worth of products.

Very encouraging for SMB eCommerce/WooCommerce stores, right?

However, the competition is equally fierce as more and more businesses are diving into eCommerce. To beat your competition and survive in the digital landscape, you need to attract your customers with compelling offers.

One proven and winning strategy for online success is to offer different types of discounts.

We all believe a penny saved is a penny earned, and that’s why discounts and coupons are significantly effective, be it for stores online or offline.

And one of the best discount types is percentage discounts.

💡 In this article, we will talk about WooCommerce percentage discount and show you step-by-step how to display discount percentage in WooCommerce.

Let’s begin.

What is a WooCommerce Percentage Discount?

There are two most common discount types –

  • Fixed amount discount
  • Percentage discount

In fixed-amount discounts, you reduce a fixed amount of the product’s original price. For example, a $10 discount from a $50 product means you will charge $40 when the discount is applied.

On the other hand, a WooCommerce product discount percentage means you are reducing product prices by a percentage.

For example, a 10% discount on a $50 product means you are reducing $5 off the product (10% of $50 is calculated as $50 * 0.10 = $5.). This means the cart total will be $45 after the discount is applied.

You can create a wide range of percentage discounts for your WooCommerce store.

Here are some examples –

  • WooCommerce percentage discount on total order or cart subtotal.
  • Percentage discount on specific categories.
  • WooCommerce bulk percentage discount.
  • Percentage discounts on bundled product sets.
  • Discount based on the quantity added to the cart.
  • Percentage discount on product combinations.

Simply put, you can create all sorts of general and conditional discounts based on percentages.

How to Create and Display Discount Percentage in WooCommerce

There are three ways to create a WooCommerce percentage discount in WooCommerce.

  • Using coupon codes
  • By adding custom codes to auto-apply discounts
  • Using a WooCommerce discount percentage plugin

Let’s start with the WooCommerce coupon percentage discount option.

Way 1: How to Create Percentage Discount Coupon Code WooCommerce

WooCommerce comes packed with very useful coupon features. You can easily create a WooCommerce percentage discount coupon code using the built-in tool.

Log in to your WordPress Woo site and go to Marketing >> Coupons.

create coupon

Click on the Add Coupon button, and it will take you to the following window.

woocommerce coupon

To create a WooCommerce percentage discount, select the Percentage discount option from the Discount Type dropdown.

WooCommerce percentage discount coupon

Let’s say you want to offer a 15% sitewide WooCommerce percentage discount. Enter your value in the Coupon Amount box.

coupon settings

You can either write a coupon code yourself or use the Generate coupon code button to auto-generate the WooCommerce percentage discount codes.

Let’s try it out in the front end. Add some products to the cart and click the Add a Coupon link on the cart page. This link may appear differently depending on your theme.

add coupon

Enter the coupon code you created and hit apply.

add coupon code

As a result of entering the coupon code, WooCommerce will apply a 15% WooCommerce percentage discount on the cart total.

WooCommerce percentage discount using coupons

Let’s check what other options are available. Using these options, we will create different percentage discount WooCommerce coupons.

Creating a Percentage Discount Coupon on Total Spend

Let’s say you want to offer a 15% discount when the customer adds a minimum $100 worth of items. To achieve this, you need to go to the Usage Restriction tab.

usage restricitons

You need to enter the amount in the Minimum Spend box.

WooCommerce percentage discount on minimum spend

You can also set a maximum spend amount.

set minimum cart value

Save this coupon and check if it is working from the front end. If you refresh the previous cart, it will return the following warning, stating the coupon has been removed because the minimum cart subtotal must be $100.

coupon not applied

Let’s add some products to take it over $100 and then add the coupon again.

WooCommerce percentage discount coupon code

It will reduce the total by 15% and display discount percentage WooCommerce discounted cart total.

WooCommerce percentage discount

Creating a WooCommerce Percentage Discount for Specific Product/Products

There are fields for selecting and excluding products under the Usage Restriction tab.

filter by products

If you want to offer discounts on specific products, you can select the ones from the Products field.

select products

As a result, the coupon will only work when the customer adds the targeted products to the cart.

Creating Percentage Discounts for Categories

You can create categories for organizing your inventory, making your site comfortable for users to navigate. Categories can also be helpful when you create specific ones for new launches, top-rated products, or seasonal catalogs.

You can also create categories to offer particular discounts, such as holiday discounts (Black Friday, Cyber Monday, etc.). You can create percentage discount coupons for any of the Woo site’s categories.

To do so, go back to the Usage Restriction tab. There, you will find fields for selecting and excluding categories.

filter by categories

Search and select the categories from there to create a WooCommerce percentage discount for categories.

In addition, you can set usage limits for your coupons from the Usage Limits tab. This was how you can create percentage discounts using the built-in coupon tool.

usage limits

The biggest drawback of this method is that customers have to collect and manually input the coupon code to avail themselves of the discounts. Moreover, you cannot create advanced conditional discounts using the default tool.

Way 2: How to Create a WooCommerce Percentage Discount using Custom Codes

We don’t recommend this method unless you are familiar with coding and child themes. In the following sections, we will provide some custom codes that you can copy and paste to set up an automated WooCommerce percentage discount.

In case you are not comfortable with child themes, make a backup of all your files and then proceed. Go to Appearance >> Theme File Editor.

theme file editor

Click on the functions.php file, scroll down to the bottom, and place your codes here.

functions php

Creating a Store-wide WooCommerce Percentage Discount using Codes

Let’s say you want to offer a general 15% discount on the cart total, regardless of the products and categories selected.

Here’s the code for it.

function apply_custom_discount() {

if (is_admin() && !defined('DOING_AJAX')) return;

// Set the discount percentage

$discount_percentage = 15;

// Get the cart subtotal

$cart_subtotal = WC()->cart->get_subtotal();

// Calculate the discount amount

$discount_amount = ($cart_subtotal * $discount_percentage) / 100;

// Add the discount

WC()->cart->add_fee(__('WooCommerce Percentage Discount', 'woocommerce'), -$discount_amount);


add_action('woocommerce_cart_calculate_fees', 'apply_custom_discount');

Explanation of the Code:

  • The apply_custom_discount function is hooked to woocommerce_cart_calculate_fees, which is executed whenever the cart total is calculated.
  • The is_admin() and !defined(‘DOING_AJAX’) checks ensure that the discount is not applied when in the admin area or during AJAX calls.
  • The discount percentage is set to 15.
  • The cart subtotal is retrieved using WC()->cart->get_subtotal().
  • The discount amount is calculated by taking 15% of the cart subtotal.
  • The discount is applied to the cart as a negative fee using WC()->cart->add_fee.

Paste the code into your funcitons.php file and update it. Now, if you add some products to the cart, WooCommerce will automatically give you a 15% discount on the cart subtotal.

WooCommerce percentage discount using codes

How to Create WooCommerce Percentage Discount for Specific Products Using Custom Codes

Let’s say you want to offer a 15% discount on a single product. First, you need to collect the product ID.

You can easily copy the product ID from the All Products page.

product id

Here’s the code –

function apply_custom_discount_to_specific_product() {

if (is_admin() && !defined('DOING_AJAX')) return;

// Set the product ID and discount percentage

$product_id = 83; // Replace with the specific product ID

$discount_percentage = 15;

// Iterate through the cart items

foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {

     if ($cart_item['product_id'] == $product_id) {

         // Get the original product price

         $product_price = $cart_item['data']->get_price();

         // Calculate the discount amount

         $discount_amount = ($product_price * $discount_percentage) / 100;

         // Calculate the total discount based on the quantity

         $total_discount = $discount_amount * $cart_item['quantity'];

         // Add the discount as a negative fee

         WC()->cart->add_fee(__('Product Discount', 'woocommerce'), -$total_discount);

         break; // Apply discount to only one product




add_action('woocommerce_cart_calculate_fees', 'apply_custom_discount_to_specific_product');

When using this code for your own store, make sure you replace the product ID. Even if you add multiple items to the cart, the discount will only be applied to the specific product you selected in the code.

WooCommerce percentage discount on products

Explanation of the Code:

  • The apply_custom_discount_to_specific_product function is hooked to woocommerce_cart_calculate_fees, which is executed whenever the cart total is calculated.
  • The is_admin() and !defined(‘DOING_AJAX’) checks ensure that the discount is not applied when in the admin area or during AJAX calls.
  • The product ID and discount percentage are set.
  • The code iterates through the cart items and checks if the current item matches the specified product ID.
  • If a match is found, it calculates the discount amount based on the product price and quantity.
  • The discount is applied to the cart as a negative fee using WC()->cart->add_fee.

You can also create category-based auto-apply discounts using custom codes, which we covered in our previous article.

How to Show Discount Percentage in WooCommerce

There’s no point in auto-applying discounts without letting the customers know what rewards they earn by shopping at your store. Offering discounts is a marketing strategy to grab more paying customers and grow your sales.

To do so, you need to promote your discounts and coupons on your website as well as your marketing channels (social media, search engines, email, etc.). Let’s add the following banner to a category page to let WooCommerce show percentage discount on category pages.

WooCommerce percentage discount banner

First, upload the image to your WooCommerce site and copy the image URL.

upload image

Copy and paste the following code to funcitons.php. Make sure you replace the image URL.

function display_category_banner() {

if (is_product_category()) {

     // Get the current category

        $category = get_queried_object();

     // Define your banner image URL

     $banner_image_url = ''; // Replace with your image URL

     // Output the banner image

     echo '<div class="category-banner" style="text-align: center; margin-bottom: 20px;">';

     echo '<img src="' . esc_url($banner_image_url) . '" alt="' . esc_attr($category->name) . '">';

     echo '</div>';



add_action('woocommerce_before_main_content', 'display_category_banner', 15);

This code will show discount percentage WooCommerce banner in all your category pages in the header section. Jump to any of your category pages now, and you will see the banner in the header.

WooCommerce percentage discount banner

Customers can now see the banner and realize they are getting a discount on their purchases. You can also add CSS codes to style the banner appropriately.

customize stylesheet
.category-banner {

width: 100%;

max-width: 1200px;

margin: 0 auto;


.category-banner img {

width: 100%;

height: auto;


In addition to banners, you can also add strikethrough discount prices, messages, and badges across your website to inform customers about the WooCommerce percentage discount.

Way 3: How to Create a WooCommerce Percentage Discount Using a Plugin

Plugins allow you to provide a more flexible and feature-rich way of offering discounts and enhancing user engagement. We have covered a large number of discount creation using the plugin Discount Rules for WooCommerce in our previous articles.

You can take a look at those articles to learn how to create bundle discounts, combination discounts, bulk discounts, first-order discounts, discounts based on multiple conditions, etc. We have also covered WooCommerce percentage discounts in those articles.

Today, we will cover some basic ones we showed using codes and coupons.

Creating Storewide WooCommerce Percentage Discount using a Plugin

Add a new rule from the settings.

add rule

Select Cart Adjustment from the Discount type field.

cart adjustment

Select All products in the Filter tab.

all products

In the Discount tab, select the percentage option from the dropdown. After that enter the percentage value.

WooCommerce percentage discount value

That’s it, save the rule, and WooCommerce will apply a 15% discount on any order.

WooCommerce percentage discount

Creating a Percentage Discount Coupon Using a Plugin

This time, select Product Adjustment from the discount type.

product adjustment

Select all products and input your percentage value.

percentage value

On the Rules tab, click to add a condition.

add condition

Find and select the Coupons condition.

select coupon condition

Enter a name or code for the coupon.

name coupon

Now, instead of WooCommerce auto-applying the discount, customers must apply the coupon manually.

apply coupon

Here’s how it looks when applied.

WooCommerce percentage discount using coupon

Creating a Combination WooCommerce Percentage Discount Using a Plugin

Let’s say you want to offer a 15% discount when a customer buys a cap and a belt along with a hoodie. Select Product Adjustment again.

product adjustment

This time, we will select the targeted products instead of All Products. To do so, select Products from the dropdown menu in the Filter tab.

select products

Find and select the products and enter percentage value.

products for WooCommerce percentage discount

From the Rules tab, add the condition called Product Combination.

product comdbination

Find and select the products again, set the quantity to one, and make sure you select the combine option.

select combine

Go checkout from your front end to see if the combination discount is working.

WooCommerce percentage discount

When to Use WooCommerce Percentage Discount?

Here are some prime scenarios where WooCommerce percentage discounts can be a powerful tool for your online store:

Boost Sales and Attract New Customers

  • Store Opening or Launch Sale: Offer a percentage discount to attract new customers and generate excitement about your store launch.
  • Seasonal Promotions: Run percentage discount campaigns during peak shopping seasons like Black Friday, Cyber Monday, or holidays to compete and drive sales.
  • New Product Launch: Incentivize customers to try out a new product by offering a discount on launch.

Clear Out Inventory and Make Room for New Products

  • Slow-Moving Inventory: Encourage sales of products that aren’t selling well by offering a percentage discount. This frees up storage space and improves cash flow.
  • Seasonal Inventory Clearance: Clear out seasonal items at the end of the season with percentage discounts to make room for new inventory.

Targeted Promotions and Customer Engagement

  • Loyalty Programs: Reward your most loyal customers with exclusive percentage discounts to show appreciation and encourage repeat business.
  • Email Marketing Campaigns: Incorporate WooCommerce percentage discount into your email marketing campaigns to incentivize purchases and increase customer engagement.
  • Cart Abandonment Recovery: Win back customers who abandon their carts by offering a percentage discount on their abandoned items.

Competitive Market Strategies

  • Match Competitor Offers: If your competitors are offering discounts, consider implementing similar percentage discounts to stay competitive.
  • Price-Sensitive Customers: Attract customers who are more price-conscious by offering percentage discounts, making your products more appealing. To be honest, almost all customers are price-sensitive.

Remember: While percentage discounts can be a great tool, it’s important to use them strategically. Consider factors like profit margins, discount duration, and target audience to ensure your discounts are effective and don’t erode your profits.

Wrap up

Percentage discounts are a great way to allure new customers to try out your products or to reward loyal customers with category—or member-specific discounts.

We hope our article will help you effectively create and offer a WooCommerce percentage discount in your store.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

5,430,675+ Downloads. 583+ plus 5-star ratings. Promote products on any platform you want.