• Resolved Imageremi123

    (@remi123)


    In my opinion
    public function add_email_header( $email_heading, $email ) {
    should become
    public function add_email_header( $email_heading, $email = '' ) {
    on line 594 in kadence-woocommerce-email-designer.php

    because of PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Kadence_Woomail_Designer::add_email_header(), 1 passed in [...]/wp-includes/class-wp-hook.php on line 288 and exactly 2 expected in [...]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor ImageBen Ritner – Kadence WP

    (@britner)

    Hey,
    Every email in Woocommerce core uses two arguments when calling the header. Which plugin are you using that is not following the standards in woocommerce core? I can contact them and ask them to update their template.

    Ben

    Plugin Contributor ImageBen Ritner – Kadence WP

    (@britner)

    Just to add, I do see your point for the sake of preventing fatal errors. It is good to fix templates as well.

    Ben

    Thread Starter Imageremi123

    (@remi123)

    Hi Ben, in this case it’s WooCommerce Bookings.

    Thread Starter Imageremi123

    (@remi123)

    Also;
    add_filter( 'woocommerce_mail_content', array( $this, 'add_gmail_hack' ), 50 );
    should only be applied to HTML e-mail messages. Now we’ve got a shop which uses plain text and this results in plain text messages all starting with;
    <style type="text/css">.gm-remove-late{ display:none;}</style>= Confirm booking =

    Plugin Contributor ImageBen Ritner – Kadence WP

    (@britner)

    I’m not surprised… Woocommerce bookings.

    I’m pushing an update out with a fix for the gmail hack on plain emails.

    Ben

    Thread Starter Imageremi123

    (@remi123)

    Hi @britner

    It seems like the fix for the ‘plain email gmail hack’ has disappeared?
    The line <style type="text/css">.gm-remove-late{ display:none;}</style> is back in our plain WooCommerce emails.

    Thread Starter Imageremi123

    (@remi123)

    I’ve looked into it and the exact reason why it has come back is unclear.

    However I believe the 2 ‘gmail hack functions’ could be combined.

    OLD:

    public function check_to_add_gmail_hack( $css, $email = '' ) {
    	add_filter( 'woocommerce_mail_content', array( $this, 'add_gmail_hack' ), 50 );
    	return $css;
    }

    NEW:

    public function check_to_add_gmail_hack( $css, $email = '' ) {
    	if( Kadence_Woomail_Customizer::opt('responsive_mode') != true ) {
    		$css .= '.gm-remove-late{display:none;}';
    	}
    
    	return $css;
    }

    Which makes function add_gmail_hack unnecessary and unused.
    Because the woocommerce_email_styles filter only runs on HTML messages and, as far as I’ve seen, prepends inline CSS to woocommerce_mail_content filter.

    Plugin Contributor ImageBen Ritner – Kadence WP

    (@britner)

    It seems like the fix for the ‘plain email gmail hack’ has disappeared?

    Nothing changed with that in the last update.

    I don’t see it when I test with plain emails. Can you tell me more about your setup so I can recreate what you are seeing?

    However I believe the 2 ‘gmail hack functions’ could be combined.

    That isn’t how it works, The css has to be added late with a style tag, can’t be part of the inline css else it doesn’t work.

    Ben

    Hi Ben,

    Why exactly do you think it cannot be combined?
    I am assuming that @ remi123 tested it and it would work

    – Klaas

    Thread Starter Imageremi123

    (@remi123)

    That isn’t how it works, The css has to be added late with a style tag, can’t be part of the inline css else it doesn’t work.

    Yeah OK, that makes sense.

    Nothing changed with that in the last update.

    I don’t see it when I test with plain emails. Can you tell me more about your setup so I can recreate what you are seeing?

    Well.. since we’ve updated WooCommerce to it’s most recent version (3.9.0) it does work properly indeed.
    So; problem solved.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘$email should be optional in public function add_email_header’ is closed to new replies.