Are you looking to encourage bulk purchases with the BOGO “Buy Two Get one free” offers in your WooCommerce store? These BOGO deals encourage customers to purchase more items to get the free product, which can significantly increase your overall sales volume.
For instance, a customer buying two products to receive a third for free might spend more than they initially intended, leading to higher revenue. This strategy effectively increases revenue without requiring more customers to visit your store.
Solution: Set Up Buy Two Get One Free (BOGO) Offer in WooCommerce
The below snippet adds a “Buy 2 Get 1 Free” offer to attract shoppers to specific products. This applies a free item for every two purchased items of targeted products.
add_action('woocommerce_cart_calculate_fees', 'ts_buy_two_get_one_free', 10, 1 ); function ts_buy_two_get_one_free( $cart ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; // Set your targeted free product IDs $targeted_product_ids = array(34); $each_n_items = 2; // Number of items required to get a free one $discount = 0; // Initializing foreach ( $cart->get_cart() as $cart_item ) { if ( in_array( $cart_item['product_id'], $targeted_product_ids ) ) { $qty = intval( $cart_item['quantity'] ); // Calculate discount based on the number of items $free_items = floor( $qty / ($each_n_items + 1) ); $discount += $free_items * floatval( $cart_item['data']->get_price() ); } } if ( $discount > 0 ) { // Displaying a custom notice (optional) wc_clear_notices(); wc_add_notice( __("Congratulations! You've earned a free item for every 2 purchased items."), 'success'); // Apply the discount $cart->add_fee( __("Buy 2 Get 1 Free"), -$discount, true ); } }
Output
When a customer adds three of the same items, they will receive one item for free. The discount will be automatically applied to the cart totals section of the WooCommerce cart page as shown below.
![How to Set Up Buy Two Get One Free (BOGO) Offer in WooCommerce? 1 How to Implement Buy Two Get One for Free Offer in WooCommerce Cart?](https://media.tychesoftwares.com/wp-content/uploads/WooCommerce-Implement-BOGO-for-free-product-Cart-Page.png)
Explore similar discount strategies such as offering bulk quantity discount (Buy 10 Get 1 Free) in WooCommerce which will make customers buy items in bulk quantities and boosts the average order value. If you have any specific requirements, feel free to mention it in the comment section!