• Resolved Steve

    (@sziangos)


    Hi,

    Was working great until yesterday, now getting following error:

    PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function WC_Emails::email_header(), 1 passed in /home/public_html/wp-includes/class-wp-hook.php on line 287 and exactly 2 expected in /home/public_html/wp-content/plugins/woocommerce/includes/class-wc-emails.php:269
    Stack trace:
    #0 /home/public_html/wp-includes/class-wp-hook.php(287): WC_Emails->email_header(‘Quotation Reque…’)
    #1 /home/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array)
    #2 /home/public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
    #3 /home/public_html/wp-content/plugins/quotes-for-woocommerce/templates/emails/new-request-sent-customer.php(15): do_action(‘woocommerce_ema…’, ‘Quotation Reque…’)
    #4 /home/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include(‘/home/…’)
    #5 /home/public_html/wp-content/plugins/quotes-for-woocommerce/includes/emails/class-qwc-request-sent.php(145): wc_ in /home/public_html/wp-content/plugins/woocommerce/includes/class-wc-emails.php on line 269

    I cant figure this out, any suggestions?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Steve

    (@sziangos)

    Thread Starter Steve

    (@sziangos)

    There are two ways to fix this.

    Method 1) Change “public function email_header( $email_heading, $email )” in \public_html\wp-content\plugins\woocommerce\includes\class-wc-emails.php Doing the fix here is only temporary because once there is another woocommerce update this file may be updated and the change will be reverted.

    Change this at line 269:

    	public function email_header( $email_heading, $email ) {
    		wc_get_template(
    			'emails/email-header.php',
    			array(
    				'email_heading' => $email_heading,
    				'email'         => $email,
    			)
    		);
    	}
    

    To the old function before the woocommerce update:

    	public function email_header( $email_heading ) {
    		wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading ) );
    	}
    

    Method 2) This changes code only in the (Quotes for woocommerce) plugin, but there’s a annoying few steps because there’s something else that is broken, custom email templates are saved to a incorrect folder.

    Step 1: Go into WP-Admin – Woocommerce > Settings > Emails

    Step 2: Click on “New Quote Request Sent” to Manage

    Step 3: Go down to HTML and click on (Copy file to theme) –
    This should copy the file to
    \public_html\wp-content\themes\your-theme\quotes-for-wc\emails\new-request-sent-customer.php

    but it instead copies it to
    \public_html\wp-content\themes\your-theme\woocommerce\emails\new-request-sent-customer.php

    If this happens you have to manually move new-request-sent-customer.php to \public_html\wp-content\themes\your-theme\quotes-for-wc\emails\new-request-sent-customer.php

    Step 4: Open \public_html\wp-content\themes\your-theme\quotes-for-wc\emails\new-request-sent-customer.php and change following:

    Line 15:
    do_action( 'woocommerce_email_header', $email_heading );

    to

    do_action( 'woocommerce_email_header', $email_heading, $email );

    Plugin Author pinal.shah

    (@pinalshah)

    Hi all,

    I apologize. Will be releasing an update with the fix soon.

    Thanks,
    Pinal

    Plugin Author pinal.shah

    (@pinalshah)

    Hi Steve,

    An update has been released (v1.7.1) fixing this issue. Once again, please accept apologies for the issues faced.

    Thanks,
    Pinal

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Uncaught ArgumentCountError: Too few arguments to function WC_Emails::email_head’ is closed to new replies.