Introduction

Promotions like “Buy 1 Get 1 Free” and “Buy 2 Get 1 Free” are classic retail drivers. But what if you want these offers to apply across all products of the same brand—not just one specific item—on your Shopify store? For many pharmacy stores, especially those with diverse brands and thousands of SKUs, this is a must-have feature.

At Seamedia E-commerce Solutions, we specialize in solving these challenges for ambitious online retailers. When two leading pharmacies in Qatar—RAF Pharmacy and Wellcare Pharmacy—asked for this feature, we discovered something surprising:
No Shopify app, not even on Shopify Plus, supports this “brand-level B2G1” promotion out of the box.

Special Offers Wellcare Pharmacy

So, we built it!

The Challenge: Brand-Specific Buy 2 Get 1 Free

Shopify’s default discount engine and third-party apps only provide BOGO deals at the product or collection level, and rarely allow “mix-and-match” logic across all products of the same brand.

Our requirements:

  • The “Buy 2 Get 1 Free” offer must work for any combination of products under the same brand/vendor.
  • The offer must update live, whether items are added from the product page, the collection page, or the cart drawer.
  • All cart and mini-cart UI must reflect the promotion accurately, including eligibility messages, free items, and total savings.
  • The free items are always low-cost. If low-cost items are added as normal before higher-cost free items, we need to swap items.
  • Support seamless user experience for busy pharmacy shoppers.
Wellcare Pharmacy Cart

Our Research & Why Custom Was Needed

Our team at Seamedia E-commerce Solutions spent days evaluating:

  • Shopify discount rules
  • Major BOGO apps (none supported brand/vendor-level logic)
  • Shopify Scripts & Functions (Shopify Plus only, still not flexible enough)
  • Community forums and snippets

Conclusion:
There was no app or off-the-shelf solution for this use case. If you want true “Buy X Get Y” by brand on Shopify, you must go custom.

Our Solution: Custom Shopify Cart Script for Buy 2 Get 1 (and BOGO) By Brand

We engineered a robust, front-end JavaScript module, deeply integrated with Shopify’s AJAX cart and theme, powering seamless “Buy 2 Get 1 Free” offers for RAF Pharmacy and Wellcare Pharmacy. Along with frontend javascript module we used shopify draft API for order creation thru backend module.

Key Features

  • Mix & Match Across Brand:
    Buy any 2 products from the same brand, get 1 free—automatically.
  • Real-Time Cart Updates:
    Works from product pages, collection pages, and the mini cart.
  • Stock Aware:
    Ensures free items are only offered if in stock.
  • Visual Cart Feedback:
    Free items are labeled, and eligibility messages are shown in the mini cart/footer.
  • Intelligent Removal:
    If you remove a qualifying item, the free item is also removed.

Test Cases and Real-World User Stories

Our development and QA team designed thorough test cases to guarantee a smooth, bug-free customer experience. Here’s how the feature performs in real life:

Test CaseExpected Result
Add 3 qty of the same item from the product details page2 paid, 1 free item appears in the cart
Add 1 qty 3 times from the main (collection) page (same item)2 paid, 1 free in the cart
Add 2 qty from the main page, increase by 1 in the mini cart2 paid, 1 free in the cart
In the mini cart, reduce paid qty from 2 to 1 when 1 free is presentFree item is automatically removed
Remove main item from the cartCorresponding free item is also removed
Add 1 qty from main, then increase in mini cartEvery 3rd, 5th, 7th… is free
Remove free item directlyPaid item quantity remains unchanged
Try to add “Buy 2 Get 1” products from a different brandTreated as normal (no offer), promo only applies per brand
Add “Buy 2 Get 1” item to cartShow eligibility for free item in mini cart footer
Add 2 qty of “Buy 2 Get 1” item to cartFooter displays eligible free item count
After selecting free itemsEligible free item count updates/disappears if 0

Bonus:
If a customer adds and removes items repeatedly (from any cart view), the offer logic and eligibility always remain accurate, giving customers confidence in their savings.

How the Solution Works (Behind the Scenes)

  1. Products are tagged (e.g., buy-2-get-1, buy-1-get-1) in Shopify admin.
  2. Cart script tracks all items by brand and tag as they’re added—no matter which page.
  3. Every time the cart is updated:
    • The script checks for eligible free items by brand.
    • Free items are auto-added and marked in the cart.
    • Cart/mini-cart footer notifies the shopper how many free items are available to claim.
    • If the main item quantity drops below the threshold, the free item is removed.
  4. User removes a free item?
    The main product quantity stays untouched.
  5. Mixing brands?
    Each brand’s offer is managed independently; no cross-brand promotions are triggered.

Client Success: Seamless Shopping at RAF and Wellcare Pharmacies

Both RAF Pharmacy and Wellcare Pharmacy are top pharmacy brands in Qatar, trusted by thousands of shoppers every day.
With this solution, their customers enjoy a true “mix and match” offer experience—without confusion, missed offers, or manual coupon codes.

Screenshots:

  • Cart showing main items and free items, labeled by brand
  • Mini cart eligibility message: “You are eligible for 1 more free item from the same brand! Add it now!”

Why Choose Seamedia E-commerce Solutions for Custom Shopify Development?

  • Proven expertise in advanced Shopify customization
  • Deep understanding of retail and pharmacy workflows
  • Experience building B2B and B2C features for leading Middle East brands
  • Reliable support and ongoing optimization

Want a Similar Feature for Your Shopify Store?

If your business needs a custom “Buy X Get Y” logic, cart-level promotion, or any unique Shopify feature, contact Seamedia E-commerce Solutions today.
We’ll consult, develop, and deploy a robust solution—so you can run offers your competitors can’t match.

Frequently Asked Questions

1. How is this Buy 2 Get 1 Free feature different from standard Shopify discount apps?
Our solution works at the brand level, letting customers mix and match any eligible products from the same brand and still receive the offer—something standard discount apps or Shopify’s built-in tools can’t do.

2. Can customers add free items from different brands to the cart?
No, the free item eligibility is calculated per brand. Customers can only get free items from the same brand as their qualifying purchases. Mixing brands treats items as normal, without activating the offer.

3. Does the free item automatically appear in the cart?
Yes! Once the qualifying threshold is reached (e.g., add any 3 items from the same brand for Buy 2 Get 1 Free), a free item is automatically added and clearly labeled as “Free” in the cart and mini cart.

4. What happens if a customer removes a qualifying item?
If a customer removes a main (paid) item, the script also removes the associated free item, ensuring the offer logic stays accurate at all times.

5. Can this custom script be adapted for other types of promotions (e.g., Buy 3 Get 2 Free, or by category instead of brand)?
Yes, the script is modular and can be adapted for more complex offers or different criteria (such as category or custom tags). Contact Seamedia E-commerce Solutions for custom requirements.