Skip to content

Instantly share code, notes, and snippets.

@NickGreen
Created April 3, 2020 21:47
Show Gist options
  • Select an option

  • Save NickGreen/e8a51dc1cdf95cbd6bc1622bc506bcc9 to your computer and use it in GitHub Desktop.

Select an option

Save NickGreen/e8a51dc1cdf95cbd6bc1622bc506bcc9 to your computer and use it in GitHub Desktop.
Replace coupon amount display with a string
<?php // don't copy this line
add_filter( 'woocommerce_cart_totals_coupon_html', 'custom_cart_totals_coupon_html', 30, 3 );
function custom_cart_totals_coupon_html( $coupon_html, $coupon, $discount_amount_html ) {
$discount_amount_html = '<span>Redeemed</span>';
$coupon_html = $discount_amount_html . ' <a href="' . esc_url( add_query_arg( 'remove_coupon', urlencode( $coupon->get_code() ), defined( 'WOOCOMMERCE_CHECKOUT' ) ? wc_get_checkout_url() : wc_get_cart_url() ) ) . '" class="woocommerce-remove-coupon" data-coupon="' . esc_attr( $coupon->get_code() ) . '">' . __( '[Remove]', 'woocommerce' ) . '</a>';
return $coupon_html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment