

The classic cart: the gift is shown as Free, its quantity is fixed, and the total doesn't include it.
Run offers like “Use code FREEMUG and get a mug free” with the coupons you already use.
Choose a Free gift product on any coupon. When a customer applies that coupon, one of that product is added to their cart for free. The gift tags along with the coupon: remove the coupon and the gift goes too, and the other way round. The gift is clearly labelled on the order, so whoever packs it knows why it’s there.
tagalong_gift_coupon_map: map coupon codes to product or variation IDs in code.tagalong_gift_product_id: decide the gift for a coupon at runtime.tagalong_remove_coupon_with_gift: return false to keep the coupon when the gift is removed.tagalong_free_price_html: change the “Free” label in the classic cart.The source code and end-to-end tests are on GitHub.