Code-Snippets-Functions/Execute a function on a child site/WooCommerce/change-add-a-coupon-txt-cart-checkout.txt

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 );