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