• Resolved Jan444

    (@ign2009)


    Hi guys,

    I’m able to automatically send mails when an order is completed, however they’ll come with an empty Subject and Heading.

    Strangely enough, when I manually resend them from the Orders area, they are sent out just fine to the client’s Inbox (with Subject, Heading, and all properly translated).

    Do you have any idea what the problem can be?
    Many thanks,

    https://www.ads-software.com/plugins/woocommerce-multilingual/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello Jan,
    When you send e-mails from the admin backend in orders, our plugin hooks to the specific actions that are used there.
    I have some suspicion that you may be sending the e-mails, while ignoring our custom hooks and this might be the problem.
    Other possibility is timing. If you send the e-mails with very high priority, it might be that you might be skipping the loading of the translated strings for these e-mails.
    In all cases, it very much depends on the code that you are using.
    Perhaps a good idea would be that you take a look at our code inside: \wp-content\plugins\woocommerce-multilingual\inc\emails.class.php and see how the e-mails are being sent.

    Thread Starter Jan444

    (@ign2009)

    Hi George, many thanks for the suggestions.

    I went up and down investigating and testing, re-doing the steps to introduce dynamic textes on Woo’s Settings, scan themes and plugins, translate them properly, test emails Subjects and Headings… but couldn’t find the culprit.

    We are using the typical ways in which WooCommerce processes an order. I even tried without any other plugins than the essentials (Woo, Woo Multi, WPML), but nothing.

    On WPML’s Strings area, I can search and find the dynamic strings, they’ll show their context, name, string and status, I translate them, but they’ll be sent empty in any language when the order is processed (the rest of the mail is properly translated though).

    I came up with this code to “force it” (to place on functions.php), but I’m unsatisfied with such a solution, even if it works. Replace TEXTDOMAIN for your theme’s text domain, then re-scan the theme, and translate.

    I’ll mark the thread as resolved but it’s still bugging me as I’m sure I’m missing some small and important thing on all this.

    Cheers,

    //Attempt to warrant Subject line and Heading line in mails
    add_filter('woocommerce_email_subject_customer_completed_order','new_order_subject');
    function new_order_subject($subject){
    	$subject= __( 'Vielen Dank für Ihre Zahlung','TEXTDOMAIN');
    	return $subject;
    }
    add_filter('woocommerce_email_heading_customer_completed_order','new_order_subject2');
    function new_order_subject2($heading){
    	$heading= __( 'Best?tigung Ihrer Kreditkartenzahlung','TEXTDOMAIN');
    	return $heading;
    }
    add_filter('woocommerce_email_subject_customer_processing_order','new_order_subject3');
    function new_order_subject3($subject){
    	$subject= __( 'Vielen Dank für Ihre Zahlung','TEXTDOMAIN');
    	return $subject;
    }
    add_filter('woocommerce_email_heading_customer_processing_order','new_order_subject4');
    function new_order_subject4($heading){
    	$heading= __( 'Best?tigung Ihrer Kreditkartenzahlung','TEXTDOMAIN');
    	return $heading;
    }
    add_filter('woocommerce_email_subject_new_order','new_order_subject5');
    function new_order_subject5($subject){
    	$subject= __( 'Neue Einzahlung per Kredit Karte','TEXTDOMAIN');
    	return $subject;
    }
    add_filter('woocommerce_email_heading_new_order','new_order_subject6');
    function new_order_subject6($heading){
    	$heading= __( 'Neue Einzahlung','TEXTDOMAIN');
    	return $heading;
    }

    Thank you for coming back to us to share your code.

    Ced

    (@cedriccharles)

    Hello @jan444,

    I have the exact same problem. Did you find a good solution other than you code ?

    Thank you in advance !

    Thread Starter Jan444

    (@ign2009)

    Hi there! We fixed it with the code avobe finally.

    Another clue is, I remember that when sending the transactional emails manually from “Orders”, the title and subject were fine (ie. they appeared when resending them, or changing the Order status).

    Also, we had our main language other than english, like it could be your case, and I vagely remember this could create some problems when translating strings for some (older) WPML versions. WPML changed that problem in the last releases I think.

    Best regards,

    Ced

    (@cedriccharles)

    Thank you Jan444. WPML is up to date, and I also have no problem when resending them through the admin order details page…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Empty Subject line (and email heading)’ is closed to new replies.