Search
 
SCRIPT & CODE EXAMPLE
 

PHP

change apply coupon text woocommerce

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;
}
Comment

PREVIOUS NEXT
Code Example
Php :: php get error 
Php :: php file hash 
Php :: * * * * * cd /path-to-your-project && php artisan schedule:run /dev/null 2&1 
Php :: codeigniter 3 session not working after some time 
Php :: decode a nested JSON with php 
Php :: php xpath get all image 
Php :: wp add_action 
Php :: PHP If If Else Else Statement 
Php :: routing in laravel 
Php :: how to empty an array in php 
Php :: update to php 7.4 
Php :: parse php 
Php :: array_diff php 
Php :: laravel collection union 
Php :: meta_value wordpress 
Php :: php include file for its symlink directory 
Php :: Magento 2 create admin module 
Php :: strcmp php 
Php :: laravel sanctum authentication 
Php :: list function php 
Php :: php online test 
Php :: laravel 8 jwt api authentication 
Php :: what is isset in php 
Php :: array to string conversion in laravel controller 
Php :: laravel with select 
Php :: php ascii to decimal 
Php :: laravel login and registration with command 
Php :: Get the Last Character of a String in PHP 
Php :: PHP strcoll — Locale based string comparison 
Php :: php artisan vendor:publish --provider="SpatieActivitylogActivitylogServiceProvider" --tag="activitylog-migrations" 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =