How to preserve discount set with query parameters into cart?
My current implementation:


Custom action triggered on "Calculating the sell price of a product":

looks for the query parameter "code" in the url
verifies code is valid and active (uses commerce_coupon)
applies it to the line item on product landing page
saves code as a session variable

Custom action triggered on "After adding a product to the cart"

looks for code as a session variable
verifies code is valid and active
uses 'commerce_coupon_redeem_coupon' to apply to cart order
clears the session variable



This seems to work, though it seems a bit rube goldberg. Still looking for a better way to preserve a discount that arrived as a query parameter, and apply it to a cart order, if there is one.