Offering flat amount discounts for bulk purchases is an excellent way to boost your store’s average order value. This approach encourages customers to buy more at once, additionally, it turns one-time shoppers into repeat buyers. Let’s explore how to implement this strategy in WooCommerce to maximize your store’s sales potential.
Solution: Add a Flat Discount Amount for Bulk Quantity Purchase in WooCommerce
The code helps to check the quantity of items for certain products present in the cart and when the threshold quantity is greater than or equal to the defined threshold value, a flat discount of $500 is applied.
add_action('woocommerce_cart_calculate_fees', 'ts_add_custom_discount_for_specific_products', 10, 1); function ts_add_custom_discount_for_specific_products($wc_cart) { if (is_admin() && !defined('DOING_AJAX')) return; $discount_amount = 500; $item_count = 0; $specific_product_ids = array(100, 457, 396); // Change this to the desired product IDs foreach ($wc_cart->get_cart() as $cart_item) { // Count each item in the cart $item_count += $cart_item['quantity']; // Check if the product ID is in the array of specific products if (in_array($cart_item['product_id'], $specific_product_ids)) { $specific_product_in_cart = true; } } // Check if there are at least 10 items in the cart and at least one specific product is present if ($item_count >= 10 && isset($specific_product_in_cart)) { // Apply the fixed discount $wc_cart->add_fee('Buy 10 Get $50 Discount', -$discount_amount, true); // Displaying a custom notice (optional) wc_clear_notices(); wc_add_notice(sprintf(__("Congratulations! You have qualified for a flat %s discount."), wc_price($discount_amount)), 'notice'); } }
Output
When the customer adds the products defined by the targeted product IDs in the code, and if the total quantity of these items is 10 or greater, the code applies a fixed discount of $500.
![How to Offer Flat Discount for Bulk Quantity Purchase in WooCommerce? 1 How to Offer Flat Discount for Bulk Quantity Purchase in WooCommerce? - Tyche Softwares](https://media.tychesoftwares.com/wp-content/uploads/flat-discount-for-bulk-quantity-1024x923.png)
Similarly, you can also add dynamic bulk WooCommerce discount tiers based on quantity that will dynamically apply the discount based on the defined tiers.