woothemes/woocommerce — pull request #4507 by thenbrent (2014-01-14 02:19:08+00:00)
Title: Cart coupon filters

At the moment, it's impossible for an extension to display a coupon amount that is not stored in `WC()->cart->coupon_discount_amounts` because there is no way to hook into `wc_cart_totals_coupon_html()`.

This can cause problems. For example, when purchasing a subscription, discounts for the recurring total are stored in `WC()->cart->recurring_coupon_discount_amounts` not in `WC()->cart->coupon_discount_amounts` (to ensure totals are calculated correctly).

This patch adds two new filters which plugin devs can use to hook into `wc_cart_totals_coupon_html()`.

Two filters are added because:

1. adding just `woocommerce_cart_totals_coupon_html ` would require either duplicating much of the `wc_cart_totals_coupon_html()` function's code or some regex madness just to change the coupon amount being displayed (as the entire discount string, including "[Remove]" link is passed through it)
1. adding just `woocommerce_coupon_discount_amount_html` would mean *only* the discount amount could be changed, but while I was here, I figured I'd make it possible for plugin devs to change the "Free shipping coupon" string, the "[Remove]" link and anything else.