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

How To Add BOGO (Buy One Get One) Offer for Featured Products in WooCommerce?

In WooCommerce, you can increase the visibility of new arrivals, seasonal products, or any other products they wish to highlight on the home page or category pages, then featuring them is the best option. Featured products often experience higher engagement, click-through rates, and conversions because they are more prominently displayed. To speed up this process, you can focus on implementing BOGO promotional efforts around these products, which will boost sales and improve the overall marketing ROI

Add BOGO (Buy One Get One) Offer for Featured Products in WooCommerce

This code snippet dynamically adds a specified free product to the WooCommerce cart if any featured product is found in the cart

add_action('woocommerce_cart_calculate_fees', 'ts_bogo_featured_products');

function ts_bogo_featured_products($cart) {
    if (is_admin() && !defined('DOING_AJAX')) {
        return;
    }    
// Check if the cart is empty
    if ($cart->is_empty()) {
        return;
    }

    // Initialize variables for the featured product
    $free_product_id = 470; // Replace with your free product ID

    // Check if the cart contains any featured product
    $featured_product_in_cart = false;

    foreach ($cart->get_cart() as $cart_item) {
        $product = $cart_item['data'];
        if ($product->is_featured()) {
            $featured_product_in_cart = true;
            break;
        }
    }

    // If any featured product is in the cart, add the free product
    if ($featured_product_in_cart) {
        // Check if the free product is not already in the cart
        $free_product_in_cart = false;

        foreach ($cart->get_cart() as $cart_item) {
            if ($cart_item['product_id'] == $free_product_id && !$cart_item['data']->is_featured()) {
                $free_product_in_cart = true;
                break;
            }
        }

        // If the free product is not in the cart, add it
        if (!$free_product_in_cart) {
            $cart->add_to_cart($free_product_id, 1);
        }
    }
}

Let’s look into how a product is set up as a featured product in WooCommerce.

  • Go to your WordPress admin dashboard.
  • Navigate to the “Products” section.
  • Find the product you want to feature.
  • Click on the star icon next to the product. When the product is featured, the star icon will be filled in.

In the below image, there are examples of some of the high-value items that are being marked as featured products.

How To Add BOGO (Buy One Get One) Offer for Featured Products in WooCommerce? - Tyche Softwares
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 any featured product to the cart, the free product also gets automatically added to the cart as shown below.

Add BOGO (Buy One Get One) Offer for Featured Products

Just like this, you can promote downloadable products using BOGO offers in WooCommerce. Offering buy one get one offer for downloadable products in WooCommerce will attract more customers and is a valuable strategy for online stores aiming to expand their digital product offerings.

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