mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-03 12:12:25 +08:00
https://wordpress.org/support/topic/how-to-change-add-a-coupon-text-to-something-else-on-the-basket-and-checkout/
11 lines
440 B
Text
11 lines
440 B
Text
function change_add_coupon_text( $translated_text, $text, $domain ) {
|
|
// Target only WooCommerce text domain
|
|
if ( 'woocommerce' === $domain ) {
|
|
// Change "Add a coupon" on Cart and Checkout
|
|
if ( 'Add a coupon' === $text ) {
|
|
$translated_text = 'Apply Discount Code'; // Replace with your custom text
|
|
}
|
|
}
|
|
return $translated_text;
|
|
}
|
|
add_filter( 'gettext', 'change_add_coupon_text', 10, 3 );
|