Skip to content

Instantly share code, notes, and snippets.

@Acephalia
Created March 20, 2024 23:35
Show Gist options
  • Save Acephalia/5b4bc9b24685f9d757198cc9cffa83f8 to your computer and use it in GitHub Desktop.
Save Acephalia/5b4bc9b24685f9d757198cc9cffa83f8 to your computer and use it in GitHub Desktop.
Woocommerce Change Password Protected product Error Notice
function custom_password_protected_error_message( $translated_text, $text, $domain ) {
if ( $text === 'This product is protected and cannot be purchased.' ) {
$translated_text = 'Your custom error message here.';
}
return $translated_text;
}
add_filter( 'gettext', 'custom_password_protected_error_message', 20, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment