Discount based on number of – Woocommerce

Discounts are a powerful marketing weapon which allows you to drive customer loyalty and revenue.

Suppose you would like to have a  discount based on number of items in cart. After you added 2 products to the cart, you get a discount. More products you add and more discount you get.

For example:

  • 1 product – full price (No Discount)
  • 2 products – full price with 10% discount of the combined price
  • 3 products – full price with 15% discount of the combined price
  • 4 products – full price with 20% discount of the combined price
  • And so on …

Yes its possible to use a trick, to achieve this. Normally for discounts on cart we use in WooCommerce coupons. Here coupons are not appropriated. I will use here a negative conditional fee, that becomes a discount.

So Here is this code:

Naturally, this goes in function.php file of your active child theme (or theme) or also in any plugin file.

This code is tested and works.

Another option is to use a plugin

Woocommerce All Discounts Lite

Woocommerce All Discounts Lite is built using WordPress best practices both on the front and the back end. This results in an efficient, robust and intuitive plugin. It’s works with any theme, including the default WordPress themes and the last Woocommerce version.


  • Percentage based discounts
  • Fixed amounts discounts


  • Customer role: Apply a discount if the customer has a specific role.
  • Previous orders count: Apply a discount based on the number of previous orders the customer made.
  • Order sub total: Apply a discount based on the order sub total.
  • Order items count: Apply a discount based on the number of items in the cart.
  • Products in cart: Apply a discount based on the products the customers is ordering (for example products in specific categories, products with specific tags or metas, products with specific attributes etc ..)

Download Woocommerce All Discounts Lite

There is also another plugin that says it does the work (i have not tested this)

WooCommerce Bulk Discount

WooCommerce Bulk Discount makes it possible to apply fine-grained bulk discounts to items in the shopping cart,
depending on the ordered quantity and on the specific product.

Here is the list of the main features:

  • Possibility to set percentage, fixed or flat bulk discount in currency units. (see FAQ section for details)
  • Possibility to set the discount individually per product.
  • Possibility to set the discount globally for all products.
  • Bulk discounts for product variations is supported to treat them separately or by shared quantity when discounting.
  • Discount is better visible and is available on several locations (see below).
  • Discount is visible on the Checkout page.
  • Discount is visible on the Order Details page.
  • Discount is visible in WooCommerce order e-mails and invoices as well.
  • Showing the applied discount when hovering over the item price in the cart.
  • Possibility of easily changing the CSS of the price before and after discount.
  • Bulk discount can or cannot be applied if a coupon code is used, depending on configuration.
  • HTML markup is allowed in information about the bulk discount offer in Product Description.
  • Bulk Discount can be disabled more easily in the Product Options page.

Download WooCommerce Bulk Discount

Also there is one of the best discounting plugin called

WooCommerce Dynamic Pricing & Discounts

Download Now 

WooCommerce Dynamic Pricing

  • Create unlimited pricing rules using a powerful rule editor
  • Control which rules are applied – all, first matched or biggest discount
  • Rule can be applied to all products in store, specific categories or specific products
  • Five different quantity calculation methods to determine pricing tier
  • Display Quantity Discount pricing table on product pages
  • Pricing table can be displayed inline or in a modal
  • Optionally set promotion start and end dates

Adjustment Methods

  • Quantity Discount – discounts increase with quantity purchased
  • Special Offer – specific amount of items purchased discounts other items
  • Exclude matched items – exclude specified items from other, usually more general rules
  • Possible to configure repeating special offer rule (e.g. free frame with each picture purchased)
  • Possible to count quantities of one set of items but apply discount to other item
  • Percentage discount, price discount or fixed price adjustments supported


  • Apply To: All products, Categories in list, Categories not in list, Products in list, Products not in list
  • Customers: All customers, Roles in list, Roles not in list, Customers in list, Customers not in list

Download Now 





Leave a Reply

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