Site icon Orion Origin

Top 3 Ways to Create WooCommerce Discount Percentages in 2024

woocommerce discount percentage

WooCommerce Discount Percentage allows store owners to grant a discount, based on what the customer purchases. It could be a discount on a product or the customer’s entire cart. When used wisely, the benefits can go from increasing the average customer order to getting rid of unsold inventory. The customers know the higher their purchase is, the higher the discount will be. It also nudges your target audience to make their first purchase, therefore increasing your clientele. 

In this guide, you will learn how to create different types of woocommerce discount percentages on your woocommerce store.

What are woocommerce discount percentages?

WooCommerce percentage discounts refer to a type of promotional offer or discount applied to products in a WooCommerce-powered online store. Percentage discounts are a way to reduce the price of a product by a certain percentage, making it more appealing to customers and potentially increasing sales. This is a common strategy used by businesses to attract customers, clear out excess inventory, promote new products, or reward loyal customers.

Here’s how WooCommerce percentage discounts work:

 The importance of offering woocommerce discount percentages?

Offering percentage discounts in WooCommerce can be a powerful strategy to achieve various business goals and benefits. Here are some reasons why you might consider offering percentage discounts in your WooCommerce store:

When implementing percentage discounts, it’s important to consider your profit margins, the goals of the discount campaign, and the overall impact on your business. While discounts can be beneficial, they should be used thoughtfully and strategically to align with your business objectives. Additionally, consider using WooCommerce’s built-in discount features or third-party plugins to manage and track your discount campaigns effectively.

Types of woocommerce discount percentages?

There are different types of scenarios you can create when offering a woocommerce discount percentage on your online store. Here are a few examples below.

Woocommerce Percentage Discount

Examples 

Percentage discount based on customer billing country

5% off product price if customer buying from China

Percentage discount based on previous customer orders

10% off product price on the second order of a customer

Percentage discount based on shipping methods

5% off product price if the product shipped using DHL

Percentage discount based on groups

20% off product price for Gold members

Percentage discount based on order counts

15% off product price on the first-year subscription

Percentage discount based on product

15% off product A

Percentage discount based on cart total

5% off every order above 50$

These are a few woocommerce percentage discount types you can create on your online store.

3 methods to Offer WooCommerce Discount Percentages

There are 3 methods to offer WooCommerce Discount Percentages on your online store: 

  1. Using coupons
  2. Using a Woocommerce discount plugin
  3. Using the programming language – PHP: This is mainly for Web developers but you can also try it out 

How to offer WooCommerce Discount Percentages using coupons?

We already have a well-curated article about how to create a WooCommerce percentage discount using coupons. This step-by-step tutorial will help you set up your discount.

How to offer WooCommerce Discount Percentages using a Discount Plugin? 

There are lots of discount plugins, but very few are simple to use and efficient. In this tutorial, we will be using the ‘Conditional Discounts for WooCommerce’ plugin. This is a Discount plugin that is impeccable for all types of discounts; percentage discounts, BOGO, fixed amounts discounts, bulk discounts, wholesale discounts, etc. 

It automatically applies discounts to customers that meet the criteria defined by the store owner. It has a free version that is perfect for what we are about to do! 

Steps to Follow:

  1. The very first step is to download and install the free version of the plugin here.
  2. Then let’s create a woocommerce product list that will contain all the products to which the discount will be applied. 
  3. Once it’s done, kindly go to Discounts > New discount to access the discounts creation page: 

4. Please enter a discount name

5. Select “Percentage off product price” in the Action field

6. Enter your discount percentage in the “Percentage / Fixed amount” field

7. Click on the Publish button to push your discount live.

8. If you want to add conditions to the application of the discount, kindly click on the “Add rules group’ button and set your terms according to your needs.

Simply follow the previous steps but select “Percentage off order subtotal” instead of “Percentage off product price” in the  “Action” field to apply a percentage discount off the order. That way, instead of applying the discount on a specific set of products, it will be applied to the entire cart.

How to offer a Woocommerce Discount Percentage using PHP?

PHP is the programming language that both Woocommerce and WordPress are built on. In this section, we will be explaining how you can set up a percentage discount by writing a piece of code.

I will strongly advise that if you do not have coding experience, you might want to ask for assistance.

Before you set up a percentage discount on a woocommerce product using a coding language, you need to understand the actions, filters, and hooks. Actions and filters are two different types of hooks that allow you to run PHP custom codes at a specific point in the execution of WordPress Core, plugins, and themes. 

WooCommerce as a WordPress plugin includes many hooks that allow you to alter its default behavior from your plugin or your theme.

Offering percentage discounts on specific products can be an effective strategy to drive sales and attract attention to certain items in your WooCommerce store. By strategically applying percentage discounts, you can incentivize customers to make purchases while also promoting specific products.

We have two types of products; we have simple products and variable products. Simple products refer to products with no variations or options while variable products have different options and variations, which could differ in prices. A good example of a variable product is a T-shirt, which is available in different sizes and colors. 

For offering percentage discounts on simple products, we’ll use two filters: 

add_filter( ‘woocommerce_product_get_price’, ‘get_product_sale_price’, 10, 2 );

add_filter( ‘woocommerce_product_get_sale_price’, ‘get_product_sale_price’, 10, 2 );

function get_product_sale_price( $sale_price, $product) {

    //This function will go through every product displayed on the page when the code runs

    //so we need to make sure to apply the discount on the product we need which ID is $product_to_discount_id

    $product_to_discount_id=123;

    $percentage=20;

    //We retrieve ID of the product that is being evaluated

    $product_id = $product->get_id();

    //If it’s the product we want to discount

    if ( $product_id == $product_to_discount_id ) {

        $percentenge_amount = $percentage/100;

        $sale_price = (float) $sale_price;

        //we apply the discount percentage and calculate the new price

        $sale_price = $sale_price – ( $sale_price * $percentenge_amount );

    }

    return $sale_price;

}

For variable products, we’ll use two other filters different from the ones used for simple products: 

add_filter( ‘woocommerce_product_variation_get_sale_price’, ‘get_product_sale_price’, 10, 2 ); 

add_filter( ‘woocommerce_product_variation_get_price’, ‘get_product_sale_price’, 10, 2 ); 

function get_product_sale_price( $sale_price, $product) {

    //This function will go through every product displayed on the page when the code runs

    //so we need to make sure to apply the discount on the product we need which ID is $product_to_discount_id

    $product_to_discount_id=123;

    $percentage=20;

    //We retrieve ID of the product that is being evaluated

    $product_id  = $product->get_id();

    //If it’s the product we want to discount

    if ( $product_id == $product_to_discount_id ) {

        $percentenge_amount = $percentage/100;

        $sale_price  = (float) $sale_price;

        //we apply the discount percentage and calculate the new price

        $sale_price  = $sale_price – ( $sale_price * $percentenge_amount );

    }

    return $sale_price;

}

Just like earlier, we’ll use WooCommerce hooks to apply our percentage discounts on the woocommerce cart. If you jumped directly to this section, kindly learn about actions, filters, and hooks here, as it’s important to what we are about to do.

//We’ll use the “woocommerce_cart_calculate_fees” action to create our discount

add_action( ‘woocommerce_cart_calculate_fees’, ‘add_order_discount’ );

function add_order_discount() {

    $percentage = 20;

    $discount_amount = (float) $percentage/100;

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

    $fee = array(

    ‘name’ => __( ‘Discount on cart’ ),

    ‘amount’ => (float) – 1 * $order_subtotal * $discount_amount,

    );

    wc()->cart->fees_api()->add_fee( $fee );

}

From the insights shared in this article, it’s clear that finding the sweet spot for discount percentages involves a delicate balance. Strategic considerations like product margins, customer psychology, and market trends must all harmonize to create compelling offers that resonate with your target audience.

Exit mobile version