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) Offers Only to New Arrivals in Your WooCommerce Store?

Offering attractive promotions like BOGO offers on New Arrivals in your store is an excellent opportunity to capture the interest of your audience. By providing BOGO deals on recently launched products, you can attract more customers to explore and test your latest offerings. Highlighting these items with a ‘New Arrival’ badge signals to shoppers that they are discovering your freshest innovations.

Solution: Add BOGO (Buy One Get One) Offers Only to New Arrivals in Your WooCommerce Store

This code snippet ensures that the “New Arrival” label is displayed only for products published within the last 5 days, and when these products are added to the cart, automatically the free product also gets added.

// Display the "New Arrival" tag on the shop page for products published in the last 5 days
add_action('woocommerce_before_shop_loop_item_title', 'ts_shop_page_new_tag', 10);

function ts_shop_page_new_tag() {
    global $product;

    // Get the current date
    $current_date = current_time('mysql');

    // Calculate the date from 5 days ago
    $five_days_ago = date('Y-m-d H:i:s', strtotime('-5 days', strtotime($current_date)));

    // Check if the product was published in the last 5 days
    if (strtotime(get_the_date('Y-m-d', $product->get_id())) >= strtotime($five_days_ago)) {
        echo '<span class="limited"><strong>' . __( 'New Arrival', 'woocommerce' ) . '</strong></span>';
        
        // Add the product with ID 470 as FREE to the cart
        $free_product_id = 470;

        // Check if the free product is not already in the cart
        if (!WC()->cart->find_product_in_cart($free_product_id)) {
            // Add the free product to the cart with a quantity of 1
            WC()->cart->add_to_cart($free_product_id, 1);
        }
    }
}
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

With the published date you can see the new arrivals of the products in the backend of your WooCommerce Store.

How to Add BOGO (Buy One Get One) Offers Only to New Arrivals in Your WooCommerce Store? - Tyche Softwares

The below image shows the products on the shop page that have the ‘New Arrival’ badge since these products are newly arrived products in the shop.

How to Add BOGO (Buy One Get One) Offers Only to New Arrivals in Your WooCommerce Store? - Tyche Softwares

So, when these specific ‘New Arrival’ badge products are added to the cart, the corresponding free product specified in the code gets automatically added to the cart.

BOGO (Buy One Get One) Offers Only to New Arrivals

If you want to apply such offers based on proven customer satisfaction i.e. for products that have high ratings, then you can apply the BOGO(Buy One Get One)deal for High-Rated Products in WooCommerce.

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