Created
March 27, 2025 05:41
-
-
Save jack-arturo/76f1f5a7c7a7cea9a8341f63f4db2cfe to your computer and use it in GitHub Desktop.
Hide the discount code on the Easy Digital Downloads checkout and show the discount name instead
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Show EDD discount name instead of code in checkout summary. | |
*/ | |
function my_custom_edd_discount_display( $discount_html, $discount ) { | |
$discount = edd_get_discount_by_code( $discount ); | |
if ( ! $discount ) { | |
return $discount_html; | |
} | |
$discount_html = str_replace( $discount . ' ', $discount->name . ' ', $discount_html ); | |
return $discount_html; | |
} | |
add_filter( 'edd_get_cart_discount_html', 'my_custom_edd_discount_display', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment