Rename Coupon Code Text in WooCommerce

I had a request from a client recently to change the ‘Coupon Code’ to ‘Offer Code’ in WooCommerce. Terminology can be a difficult to get right and that will appeal universally to your target market audience and for this client ‘offer code’ was more appropriate for how they were going to employ ‘Coupons’. My preference for ‘Coupon Codes’ would be ‘Discount Codes’ as the alternative (in my opinion) is too americanised.

There isn’t a setting to change the text by default in WooCommerce but you can add the code below to your functions.php file in your active theme folder. See bottom of the post for a link to the plugin that allows users to change it to whatever their preference is.

add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 );
add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 );
add_filter('woocommerce_coupon_error', 'rename_coupon_label', 10, 3);
add_filter('woocommerce_coupon_message', 'rename_coupon_label', 10, 3);
add_filter('woocommerce_cart_totals_coupon_label', 'rename_coupon_label',10, 1);
add_filter( 'woocommerce_checkout_coupon_message', 'woocommerce_rename_coupon_message_on_checkout' );


function woocommerce_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) {
	// bail if not modifying frontend woocommerce text
	if ( is_admin() || 'woocommerce' !== $text_domain ) {
		return $translated_text;
	}
	if ( 'Coupon:' === $text ) {
		$translated_text = 'Offer Code:';
	}

	if ('Coupon has been removed.' === $text){
		$translated_text = 'Offer code has been removed.';
	}

	if ( 'Apply coupon' === $text ) {
		$translated_text = 'Apply Code';
	}

	if ( 'Coupon code' === $text ) {
		$translated_text = 'Offer Code';
	
	} 

	return $translated_text;
}


// rename the "Have a Coupon?" message on the checkout page
function woocommerce_rename_coupon_message_on_checkout() {
	return 'Have an Offer Code?' . ' ' . __( 'Click here to enter your code', 'woocommerce' ) . '';
}


function rename_coupon_label($err, $err_code=null, $something=null){

	$err = str_ireplace("Coupon","Offer Code ",$err);

	return $err;
}

I’ve created a small WordPress plugin if you’re not a web developer. Download the Coupon Codes Renamed plugin and go to WooCommerce -> Settings -> Advanced -> Coupon Codes and put in any text that you would like to appear.

New setting added to Woocommerce with the plugin: