Support » Plugin: Stripe for WooCommerce » Change "expiry" to "expiration date"

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m looking to do this, as well.

    Hello everyone,
    EXACT same question here.
    Thanks in advance for your answer/help.
    Regards,
    Oxley

    since all text goes through wordpress, you can use the gettext filter hook to translate anything, but more importantly woocommerce text found all over the place, whether it’s from a plugin or other custom function.

    there may be a “better” way to do it using specific hooks for each string, where it appears, etc (this hook claims to be a “resource hog”) but this seems very straight-forward and simple.

    /* change wordpress text */
    function custom_text( $translated_text, $text, $text_domain ) {
    
    /* don't do this in the admin panel */
    	if ( is_admin() || 'woocommerce' !== $text_domain ) {
    		return $translated_text;
    	}
    
    /* custom text strings for woocommerce-generated page */
    
    	if ('Coupon code' === $text) {
    		return 'Promo code';
    	}
    	if ('Have a coupon?' === $text) {
    		return 'Have a promo code?';
    	}
    	if ('Apply Coupon' === $text) {
    		return 'Apply';
    	}
    	if ('Coupon usage limit has been reached.' === $text) {
    		return 'Our records show that you have already used this promo code.';
    	}
    	if('This coupon has expired.' === $text) {
    		return 'Sorry, this promo code is no longer active.';
    	}
    	if('Coupon "%s" does not exist!' === $text) {
    		return 'Sorry, "%s" is not a valid promo code.';
    	}
    	if ('Return To Shop' === $text) {
    		return 'Continue Shopping';
    	}
    	/* checkout form text */
    	if ('Your order' === $text) {
    		return 'Order Summary';
    	}
    	if ('Town / City' === $text) {
    		return 'City';
    	}
    	if ('Zip' === $text) {
    		return 'Zip Code';
    	}
    	if ('Email Address' === $text) {
    		return 'Email';
    	}
    	if ('Expiry (MM/YY)' === $text) {
    		return 'Expiration Date (MM/YY)';
    	}
    	if ('Card Code' === $text) {
    		return 'Card Verification Code';
    	}
    	return $translated_text;
    }
    add_filter('gettext', 'custom_text', 10, 3);

    This seems to have been changed in a recent Woocommerce update! Mine says “Expiration Date” and I don’t remember figuring out how to change it.

    Thank you Saturn for your help!

    Regards,
    Oxley

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change "expiry" to "expiration date"’ is closed to new replies.