WordPress filter hook

woocommerce_coupon_discount_amount_html

Defined by WooCommerce and fired by 7 plugins in total, running on 7.1M+ sites between them.

“Filter to alter the coupon discount amount HTML.”

How to use woocommerce_coupon_discount_amount_html

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_coupon_discount_amount_html', function( $discount_amount_html, $coupon ) {
	// Change $discount_amount_html here.
	return $discount_amount_html;
}, 10, 2 );

Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

7 plugins that fire woocommerce_coupon_discount_amount_html

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_amount_html, $coupon ) includes/wc-cart-functions.php:333
  2. Smart Coupons For WooCommerce Coupons icon Smart Coupons For WooCommerce Coupons30,000+ installs apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_html, $coupon ) public/modules/auto-coupon-public/class-wt-smart-coupon-auto-coupon-public.php:718
  3. Sliding Cart for WooCommerce by FunnelKit icon Sliding Cart for WooCommerce by FunnelKit30,000+ installs apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_amount_html, $coupon ) includes/front.php:658
  4. Sublium Subscriptions icon Sublium Subscriptions700+ installs apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_amount_html, $coupon ) includes/main/cart.php:1538
  5. Checkout Custom Fields Builder for WooCommerce icon Checkout Custom Fields Builder for WooCommerce30+ installs apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_amount_html, $coupon ) includes/Frontend/Woocommerce.php:507
  6. Subscriptions & Recurring Payments for WooCommerce icon Subscriptions & Recurring Payments for WooCommerce10+ installs apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_html, $coupon ) inc/inependent-functions/awc-cart-functions.php:274
  7. YayCheckout icon YayCheckoutFewer than 10 installs apply_filters( 'woocommerce_coupon_discount_amount_html', $html, $coupon ) includes/Renderer/CheckoutFragments.php:1197

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.