I'm attempting to add a coupon to an order when an item is added to the cart. I've added an event subscriber for commerce_cart.entity.add
. Within the subscriber, I use $to_apply->getPromotion()->apply($event->getCart());
.
This does end up in Promotion::apply()
and does call $offer->apply()
, but the coupon doesn't seem to actually get applied. I've tried to see if, once we arrive at /checkout/{order_id}, the promotions/coupons are reset. AFAICT, they are not.
I have confirmed that I can manually apply the coupon once on /checkout/{order_id}.
What am I missing?