{"id":127810,"date":"2023-12-10T08:27:00","date_gmt":"2023-12-10T07:27:00","guid":{"rendered":"https:\/\/discountsuiteforwp.com\/?p=127810"},"modified":"2024-02-19T14:26:10","modified_gmt":"2024-02-19T13:26:10","slug":"woocommerce-discount-percentage","status":"publish","type":"post","link":"https:\/\/www.orionorigin.com\/woocommerce-discount-percentage\/","title":{"rendered":"Top 3 Ways to Create WooCommerce Discount Percentages in 2024"},"content":{"rendered":"\n<p><span style=\"font-weight: 400\">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\u2019s 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.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">In this guide, you will learn how to create different types of woocommerce discount percentages on your woocommerce store.<\/span><\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#what-are-woocommerce-discount-percentages\">What are woocommerce discount percentages?<\/a><\/li><li><a href=\"#the-importance-of-offering-woocommerce-discount-percentages\">\u00a0The importance of offering woocommerce discount percentages?<\/a><\/li><li><a href=\"#types-of-woocommerce-discount-percentages\">Types of woocommerce discount percentages?<\/a><\/li><li><a href=\"#3-methods-to-offer-woo-commerce-discount-percentages\">3 methods to Offer WooCommerce Discount Percentages<\/a><\/li><li><a href=\"#how-to-offer-woo-commerce-discount-percentages-using-coupons\">How to offer WooCommerce Discount Percentages using coupons?<\/a><\/li><li><a href=\"#how-to-offer-woo-commerce-discount-percentages-using-a-discount-plugin\">How to offer WooCommerce Discount Percentages using a Discount Plugin?\u00a0<\/a><\/li><li><a href=\"#how-to-offer-a-woocommerce-discount-percentage-using-php\">How to offer a Woocommerce Discount Percentage using PHP?<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-are-woocommerce-discount-percentages\"><strong>What are woocommerce discount percentages?<\/strong><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">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.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Here&#8217;s how WooCommerce percentage discounts work:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Discount Calculation<\/b><span style=\"font-weight: 400\">: A percentage discount is calculated based on the original price of a product. For example, if a product originally costs $100 and a 20% discount is applied, the discounted price would be $80 (20% of $100).<\/span><\/li>\n\n\n\n<li><b>Displaying Discounts<\/b><span style=\"font-weight: 400\">: The discounted price is typically displayed on the product page alongside the original price. This helps customers see the value they&#8217;re getting and encourages them to make a purchase.<\/span><\/li>\n\n\n\n<li><b>Cart and Checkout<\/b><span style=\"font-weight: 400\">: When customers add a discounted product to their shopping cart, the discounted price is reflected in the cart total and carried through to the checkout process.<\/span><\/li>\n\n\n\n<li><b>Coupon Codes<\/b><span style=\"font-weight: 400\">: WooCommerce allows you to set up percentage discounts using coupon codes. Customers enter these codes during the checkout process to apply the discount to their purchases. For example, a coupon code could provide a 15% discount on all products in a specific category.<\/span><\/li>\n\n\n\n<li><b>Conditions and Restrictions:<\/b><span style=\"font-weight: 400\"> WooCommerce gives you the flexibility to set conditions and restrictions for your percentage discounts. For instance, you can limit the discount to specific products, product categories, user roles, minimum purchase amounts, and more.<\/span><\/li>\n\n\n\n<li><b>Time-Limited Offers<\/b><span style=\"font-weight: 400\">: You can create time-limited percentage discount offers to create a sense of urgency and encourage quick purchases. For example, you might run a weekend sale with a 25% discount on select products.<\/span><\/li>\n\n\n\n<li><b>Marketing and Promotion<\/b><span style=\"font-weight: 400\">: Promote your percentage discounts through email marketing, social media, banners on your website, and other channels to attract attention and drive traffic to your store.<\/span><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"the-importance-of-offering-woocommerce-discount-percentages\"><strong>&nbsp;The importance of offering woocommerce discount percentages?<\/strong><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">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:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Attract New Customers<\/b><span style=\"font-weight: 400\">: Percentage discounts can attract new customers to your store, especially if they&#8217;re looking for deals and bargains. A well-promoted discount can help increase your store&#8217;s visibility and bring in new visitors.<\/span><\/li>\n\n\n\n<li><b>Boost Sales<\/b><span style=\"font-weight: 400\">: Discounts can encourage hesitant customers to make a purchase, as they perceive added value in getting a product for a lower price. This can lead to increased conversion rates and overall sales.<\/span><\/li>\n\n\n\n<li><b>Clear Excess Inventory<\/b><span style=\"font-weight: 400\">: If you have products that are overstocked or nearing the end of their lifecycle, offering percentage discounts can help clear out inventory quickly.<\/span><\/li>\n\n\n\n<li><b>Promote New Products<\/b><span style=\"font-weight: 400\">: When you introduce new products to your store, offering a launch discount can generate buzz and encourage customers to try out the new items.<\/span><\/li>\n\n\n\n<li><b>Reward Loyal Customers<\/b><span style=\"font-weight: 400\">: Percentage discounts are a way to show appreciation to your existing customers. Loyalty discounts can foster customer retention and repeat business.<\/span><\/li>\n\n\n\n<li><b>Increase Average Order Value<\/b><span style=\"font-weight: 400\">: By setting up discounts that apply when customers reach a certain spending threshold, you can motivate them to add more items to their cart to qualify for the discount. This can increase your average order value.<\/span><\/li>\n\n\n\n<li><b>Create Urgency<\/b><span style=\"font-weight: 400\">: Time-limited discounts create a sense of urgency, prompting customers to purchase before the offer expires. This can help expedite decision-making.<\/span><\/li>\n\n\n\n<li><b>Compete in the Market<\/b><span style=\"font-weight: 400\">: If your competitors are offering discounts, you may need to do the same to remain competitive and not lose customers to other stores.<\/span><\/li>\n\n\n\n<li><b>Marketing Campaigns:<\/b><span style=\"font-weight: 400\"> Discounts can be incorporated into your marketing campaigns, such as holiday promotions, seasonal sales, or special events.<\/span><\/li>\n\n\n\n<li><b>Capture Abandoned Carts<\/b><span style=\"font-weight: 400\">: If a customer has added items to their cart but hasn&#8217;t completed the purchase, sending them a reminder email with a discount can entice them to finalize their order.<\/span><\/li>\n\n\n\n<li><b>Cross-selling and Upselling<\/b><span style=\"font-weight: 400\">: Discounts can be used strategically to encourage customers to purchase complementary or higher-priced items. For example, you can offer a discount on a related product when a certain product is added to the cart.<\/span><\/li>\n\n\n\n<li><b>Increase Website Traffic<\/b><span style=\"font-weight: 400\">: Promoting percentage discounts through various channels, like social media or email marketing, can drive more traffic to your website.<\/span><\/li>\n<\/ul>\n\n\n\n<p><span style=\"font-weight: 400\">When implementing percentage discounts, it&#8217;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&#8217;s built-in discount features or third-party plugins to manage and track your discount campaigns effectively.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"types-of-woocommerce-discount-percentages\"><strong>Types of woocommerce discount percentages?<\/strong><\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>\n<p><b>Woocommerce Percentage Discount<\/b><\/p>\n<\/td><td>\n<p><b>Examples&nbsp;<\/b><\/p>\n<\/td><\/tr><tr><td>\n<p><span style=\"font-weight: 400\">Percentage discount based on customer billing country<\/span><\/p>\n<\/td><td>\n<p><span style=\"font-weight: 400\">5% off product price if customer buying from China<\/span><\/p>\n<\/td><\/tr><tr><td>\n<p><span style=\"font-weight: 400\">Percentage discount based on previous customer orders<\/span><\/p>\n<\/td><td>\n<p><span style=\"font-weight: 400\">10% off product price on the second order of a customer<\/span><\/p>\n<\/td><\/tr><tr><td>\n<p><span style=\"font-weight: 400\">Percentage discount based on shipping methods<\/span><\/p>\n<\/td><td>\n<p><span style=\"font-weight: 400\">5% off product price if the product shipped using DHL<\/span><\/p>\n<\/td><\/tr><tr><td>\n<p><span style=\"font-weight: 400\">Percentage discount based on groups<\/span><\/p>\n<\/td><td>\n<p><span style=\"font-weight: 400\">20% off product price for Gold members<\/span><\/p>\n<\/td><\/tr><tr><td>\n<p><span style=\"font-weight: 400\"> Percentage discount based on order counts<\/span><\/p>\n<\/td><td>\n<p><span style=\"font-weight: 400\">15% off product price on the first-year subscription<\/span><\/p>\n<\/td><\/tr><tr><td>\n<p><span style=\"font-weight: 400\">Percentage discount based on product<\/span><\/p>\n<\/td><td>\n<p><span style=\"font-weight: 400\">15% off product A<\/span><\/p>\n<\/td><\/tr><tr><td>\n<p><span style=\"font-weight: 400\">Percentage discount based on cart total<\/span><\/p>\n<\/td><td>\n<p><span style=\"font-weight: 400\">5% off every order above 50$<\/span><\/p>\n<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><span style=\"font-weight: 400\">These are a few woocommerce percentage discount types you can create on your online store.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3-methods-to-offer-woo-commerce-discount-percentages\"><strong>3 methods to Offer WooCommerce Discount Percentages<\/strong><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">There are 3 methods to offer WooCommerce Discount Percentages on your online store:&nbsp;<\/span><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><span style=\"font-weight: 400\">Using coupons<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Using a Woocommerce discount plugin<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Using the programming language \u2013 PHP: This is mainly for Web developers but you can also try it out&nbsp;<\/span><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-offer-woo-commerce-discount-percentages-using-coupons\"><strong>How to offer WooCommerce Discount Percentages using coupons?<\/strong><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">We already have a well-curated article about how to create a <\/span><b><i><a href=\"https:\/\/docs.google.com\/document\/d\/1TEAeOqLJvkC7lg-g2Z0GKyYCIrtqos1RUBSaSDxmP40\/edit\" target=\"_blank\" rel=\"noopener\">WooCommerce percentage discount using coupons<\/a><\/i><\/b><span style=\"font-weight: 400\">. <\/span>This step-by-step tutorial will help you set up your discount.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-offer-woo-commerce-discount-percentages-using-a-discount-plugin\"><strong>How to offer WooCommerce Discount Percentages using a Discount Plugin?&nbsp;<\/strong><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">There are lots of discount plugins, but very few are simple to use and efficient. In this tutorial, we will be using the <\/span><a href=\"https:\/\/www.orionorigin.com\/product\/conditional-discounts-for-woocommerce\/\"><b>\u2018Conditional Discounts for WooCommerce\u2019<\/b><\/a><span style=\"font-weight: 400\"> 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.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">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!&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Steps to Follow<\/span>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b style=\"color: var(--global--text-color);font-family: var(--global--font-primary);font-size: calc( 1.44 * var(--global--font-size))\">Offering percentage discounts On specific products<\/b><\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><span style=\"font-weight: 400\">The very first step is to download and install the free version of the plugin <\/span><a href=\"https:\/\/wordpress.org\/plugins\/woo-advanced-discounts\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">here<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Then let\u2019s <\/span><a href=\"https:\/\/www.orionorigin.com\/tutorials\/create-your-first-product-list\/\"><span style=\"font-weight: 400\">create a woocommerce product list<\/span><\/a><span style=\"font-weight: 400\"> that will contain all the products to which the discount will be applied.&nbsp;<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Once it\u2019s done, kindly go to <\/span><b>Discounts &gt; New discount<\/b><span style=\"font-weight: 400\"> to access the discounts creation page:&nbsp;<\/span><\/li>\n<\/ol>\n\n\n\n<p><span style=\"font-weight: 400\"><img loading=\"lazy\" decoding=\"async\" width=\"1600\" height=\"953\" class=\"size-full wp-image-160292 aligncenter\" src=\"https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/News-discount-1.png\" alt=\"new discount percentage\" title=\"\" srcset=\"https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/News-discount-1.png 1600w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/News-discount-1-300x179.png 300w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/News-discount-1-600x357.png 600w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/News-discount-1-1024x610.png 1024w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/News-discount-1-150x89.png 150w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/News-discount-1-768x457.png 768w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/News-discount-1-1536x915.png 1536w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/span><\/p>\n\n\n\n<p>4. <span style=\"font-weight: 400\">Please enter a discount name<\/span><\/p>\n\n\n\n<p>5. <span style=\"font-weight: 400\">Select \u201cPercentage off product price\u201d in the Action field<\/span><\/p>\n\n\n\n<p>6. <span style=\"font-weight: 400\">Enter your discount percentage in the \u201cPercentage \/ Fixed amount\u201d field<\/span><\/p>\n\n\n\n<p>7. <span style=\"font-weight: 400\">Click on the Publish button to push your discount live.<\/span><\/p>\n\n\n\n<p>8. <span style=\"font-weight: 400\">If you want to add conditions to the application of the discount, kindly click on the \u201cAdd rules group\u2019 button and set your terms according to your needs.<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b style=\"color: var(--global--text-color);font-family: var(--global--font-primary);font-size: calc( 1.44 * var(--global--font-size))\">Offering a percentage discount on the cart total<\/b><\/li>\n<\/ul>\n\n\n\n<p><span style=\"font-weight: 400\">Simply follow the previous steps but select \u201cPercentage off order subtotal\u201d instead of \u201cPercentage off product price\u201d in the&nbsp; \u201cAction\u201d 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.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong><img loading=\"lazy\" decoding=\"async\" width=\"1600\" height=\"913\" class=\"alignnone wp-image-160293 size-full\" src=\"https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/discount-percentage-2.png\" alt=\"discount percentage\" style=\"width: 913px\" title=\"\" srcset=\"https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/discount-percentage-2.png 1600w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/discount-percentage-2-300x171.png 300w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/discount-percentage-2-600x342.png 600w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/discount-percentage-2-1024x584.png 1024w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/discount-percentage-2-150x86.png 150w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/discount-percentage-2-768x438.png 768w, https:\/\/www.orionorigin.com\/wp-content\/uploads\/2022\/05\/discount-percentage-2-1536x876.png 1536w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/strong><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-offer-a-woocommerce-discount-percentage-using-php\"><strong>How to offer a Woocommerce Discount Percentage using PHP?<\/strong><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">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. <\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">I will strongly advise that if you do not have coding experience, you might want to ask for assistance.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Before you set up a percentage discount on a woocommerce product using a coding language, you need to understand the <\/span><a href=\"https:\/\/developer.wordpress.org\/plugins\/hooks\/actions\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">actions, filters, and hooks<\/span><\/a><span style=\"font-weight: 400\">. 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.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">WooCommerce as a WordPress plugin includes many hooks that allow you to alter its default behavior from your plugin or your theme.<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li> <b style=\"color: var(--global--text-color);font-family: var(--global--font-primary);font-size: calc( 1.44 * var(--global--font-size))\">Offering percentage discount On specific products<\/b> <\/li>\n<\/ul>\n\n\n\n<p>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.<\/p>\n\n\n\n<p><span style=\"font-weight: 400\">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.<\/span><b>&nbsp;<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">For offering percentage discounts on simple products, we\u2019ll use two filters:&nbsp;<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400\">woocommerce_product_get_price and&nbsp;<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">woocommerce_product_get_sale_price.<\/span><\/li>\n<\/ul>\n\n\n\n<p><span style=\"font-weight: 400\">add_filter( &#8216;woocommerce_product_get_price&#8217;, &#8216;get_product_sale_price&#8217;, 10, 2 );<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">add_filter( &#8216;woocommerce_product_get_sale_price&#8217;, &#8216;get_product_sale_price&#8217;, 10, 2 );<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">function get_product_sale_price( $sale_price, $product) {<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;\/\/This function will go through every product displayed on the page when the code runs<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;\/\/so we need to make sure to apply the discount on the product we need which ID is $product_to_discount_id<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$product_to_discount_id=123;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$percentage=20;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;\/\/We retrieve ID of the product that is being evaluated<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$product_id = $product-&gt;get_id();<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;\/\/If it&#8217;s the product we want to discount<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;if ( $product_id == $product_to_discount_id ) {<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$percentenge_amount = $percentage\/100;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sale_price = (float) $sale_price;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/we apply the discount percentage and calculate the new price<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sale_price = $sale_price &#8211; ( $sale_price * $percentenge_amount );<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;return $sale_price;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">}<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">For variable products, we\u2019ll use two other filters different from the ones used for simple products:&nbsp;<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400\">woocommerce_product_variation_get_sale_price and<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">woocommerce_product_variation_get_price.<\/span><\/li>\n<\/ul>\n\n\n\n<p><span style=\"font-weight: 400\">add_filter( &#8216;woocommerce_product_variation_get_sale_price&#8217;, &#8216;get_product_sale_price&#8217;, 10, 2 );&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">add_filter( &#8216;woocommerce_product_variation_get_price&#8217;, &#8216;get_product_sale_price&#8217;, 10, 2 );&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">function get_product_sale_price( $sale_price, $product) {<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;\/\/This function will go through every product displayed on the page when the code runs<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;\/\/so we need to make sure to apply the discount on the product we need which ID is $product_to_discount_id<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$product_to_discount_id=123;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$percentage=20;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;\/\/We retrieve ID of the product that is being evaluated<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$product_id&nbsp; = $product-&gt;get_id();<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;\/\/If it&#8217;s the product we want to discount<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;if ( $product_id == $product_to_discount_id ) {<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$percentenge_amount = $percentage\/100;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sale_price&nbsp; = (float) $sale_price;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/we apply the discount percentage and calculate the new price<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sale_price&nbsp; = $sale_price &#8211; ( $sale_price * $percentenge_amount );<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;return $sale_price;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">}<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li> <b style=\"color: revert;font-size: revert;, sans-serif\">Offering percentage discount On the cart total<\/b> <\/li>\n<\/ul>\n\n\n\n<p>J<span style=\"font-weight: 400\">ust like earlier, we\u2019ll 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 <\/span><a href=\"https:\/\/developer.wordpress.org\/plugins\/hooks\/actions\/\" target=\"_blank\" rel=\"noopener\"><b>here<\/b><\/a><span style=\"font-weight: 400\">, as it\u2019s important to what we are about to do.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">\/\/We&#8217;ll use the \u201cwoocommerce_cart_calculate_fees\u201d action to create our discount<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">add_action( &#8216;woocommerce_cart_calculate_fees&#8217;, &#8216;add_order_discount&#8217; );<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">function add_order_discount() {<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$percentage = 20;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$discount_amount = (float) $percentage\/100;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$order_subtotal = WC()-&gt;cart-&gt;get_subtotal();<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;$fee = array(<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&#8216;name&#8217; =&gt; __( &#8216;Discount on cart&#8217; ),<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&#8216;amount&#8217; =&gt; (float) &#8211; 1 * $order_subtotal * $discount_amount,<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;);<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;wc()-&gt;cart-&gt;fees_api()-&gt;add_fee( $fee );<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">}<\/span><\/p>\n\n\n\n<p>From the insights shared in this article, it&#8217;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.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019s 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":159723,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[416],"tags":[43,221,222,17,205],"class_list":["post-127810","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-discount","tag-discount","tag-percentage","tag-woocommerce-discount-percentage","tag-wordpress","tag-wordpress-plugins"],"acf":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/posts\/127810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/comments?post=127810"}],"version-history":[{"count":14,"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/posts\/127810\/revisions"}],"predecessor-version":[{"id":160307,"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/posts\/127810\/revisions\/160307"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/media\/159723"}],"wp:attachment":[{"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/media?parent=127810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/categories?post=127810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orionorigin.com\/service\/wp\/v2\/tags?post=127810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}