A recent request: a client running WooCommerce and Elementor wanted to run
buy-one-get-one-free pricing on a line of products — but only for visitors
who clicked through from a specific Google Ad. Their ad spend is significant,
so the offer had to stay invisible to organic and direct traffic, apply
automatically with no action from the visitor, and correctly handle products
that come in multiple variations — different sizes, formats, or counts.

The discount logic itself wasn't the hard part. WooCommerce coupons handle
BOGO pricing without much trouble. The hard part was the gating: making a
promotion appear only for one traffic source, apply itself silently, survive
the trip from ad click through a landing page to checkout, and match the
exact variation a customer picked rather than any variation of that product.

How we built it

The mechanic ended up simple at its core: a coupon code embedded directly in
the ad's destination URL, using Advanced Coupons' query-string auto-apply
feature. Anyone clicking the ad lands on the products page with that code
riding silently along in the URL — nothing visible, nothing to type, nothing
that shows up for someone who just navigates to the site directly.

From there, a few pieces made it hold together:

Session deferral kept the coupon attached to the visitor as they moved
from the landing page into a product page and through checkout — surviving
normal browsing rather than a single pageview.

"Any combination" plus "same product" logic, rather than a naive
per-product rule, let one coupon cover the full product line and
automatically match whichever variation a customer actually selected. That
avoided hand-building a separate coupon for every product and variation
combination.

A cache exclusion on the coupon parameter was the one that would have
been invisible if we'd missed it. Without it, a cached page silently skips
the promo logic entirely — the kind of failure that looks exactly like a
broken plugin, but isn't.

We proved the mechanic on a single product in a private test environment
before scaling it across the full line, then rebuilt it clean on the live
site once we trusted it.

No custom code required

The part worth remembering: all of this ran on off-the-shelf WooCommerce
plugin capability. No custom development, no theme functions, nothing to
maintain outside the plugin ecosystem the client already had. The engineering
was entirely in how the pieces were configured and sequenced — the coupon
rule, the URL structure, the cache behavior — not in writing new code to make
WooCommerce do something it doesn't already do.

That's usually our first question on a request like this: can existing
tools be arranged to do it, or does it genuinely need custom code? Here, the
answer was arrangement — which means it's also easier for the client to
maintain themselves later.