This is solved. Thanks you for your time.
Since we had a need where we wanted to print out a certificate and snail mail to the customer instead of automatically emailing a digital copy.
your solution worked:
commenting out the IF on line 258
if ( ps_awo_giftcert::sendMail($from_email, $from_name, $to, $subject, $message, $profile['message_type']=='html' ? 1 : 0, $bcc, $mycodes['attachments'], $is_embed) !== true ) {
And replacing with:
if(1!=1) {
So that the certificate email would not be sent, but the error cleanup code would still execute. Full code block pasted below:
// if ( ps_awo_giftcert::sendMail($from_email, $from_name, $to, $subject, $message, $profile['message_type']=='html' ? 1 : 0, $bcc, $mycodes['attachments'], $is_embed) !== true ) {
if(1!=1) { //Code change - Replaced above line with this - we did not want certificate emails to be sent out
ps_awo_giftcert::cleanup_error($allcodes, $used_codes, $is_new, 'cannot mail codes');
return false;
}