Skip to content

Instantly share code, notes, and snippets.

@kimwhite
Last active September 23, 2024 15:58
Show Gist options
  • Save kimwhite/caf43de0feaf6eb72c78a89bc74fa4f1 to your computer and use it in GitHub Desktop.
Save kimwhite/caf43de0feaf6eb72c78a89bc74fa4f1 to your computer and use it in GitHub Desktop.
This recipe will change wording for VAT display
<?php // do not copy this line.
/**
* This recipe will change wording for VAT display
* You can remove a "case" if you don't want to change that line
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// Replace EU/European text with EK/United Kingdom
function my_pmprovat_vat_text( $translated_text, $text, $domain ) {
// Check possible text domains for PMPro VAT
if ( 'pmpro-vat-tax' === $domain ) {
// Change text strings
switch ( $text ) {
case 'European Union Residents VAT':
$translated_text = 'one Your Text Here';
break;
case 'EU customers must confirm country of residence for VAT.':
$translated_text = 'two Your Text Here';
break;
case 'Non-EU Resident':
$translated_text = 'Change me';
break;
}
}
return $translated_text;
}
add_filter( 'gettext', 'my_pmprovat_vat_text', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment