Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Offer Flat Discount for Bulk Quantity Purchase in WooCommerce?

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');
    }
}

flexi bogo cta banner image


This to the shop owners who are running or planning to run BOGO offers on their WooCommerce store…

BOGO deals are great for increasing your sales, but have you thought about which offers are bringing you more revenue and which offers are not performing that great?

Don’t just set a BOGO deal, track the revenue generated by your deals in real-time with the Flexi BOGO for WooCommerce plugin.

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? - Tyche Softwares

Similarly, you can also add dynamic bulk WooCommerce discount tiers based on quantity that will dynamically apply the discount based on the defined tiers.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x