• Resolved ComMotion

    (@werbeagenturcommotion)


    Hi,

    I’m hooking into the WooCommerce email templates with following function.

    function email_add_content( $order, $sent_to_admin, $plain_text, $email ) {
    	$order_id = $order->id;
    	$user_id = $order->get_user_id();
    
    	if ( $sent_to_admin ) {
    		if ( empty($user_id) ) { // Guest
    			echo '<h2 style="color: #bea055; display: block; font-family: &quot;Helvetica Neue&quot;, Helvetica, Roboto, Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 130%; margin: 16px 0 8px; text-align: left;">Gastbestellung</h2><p style="margin: 0 0 16px;">Diese Bestellung ist eine Gastbestellung.
    ';
    		}
    	}
    }
    add_action( 'woocommerce_email_before_order_table', 'email_add_content', 20, 4 );

    The code works perfectly but not if the customer orders via WooCommerce Checkout.

    Do you have any clue why?

    Sincerely,
    Maxim

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ComMotion

    (@werbeagenturcommotion)

    Okay, I tried it with woocommerce_email_order_details instead of woocommerce_email_before_order_table. Now it works.

    Kenin

    (@kbassart)

    Automattic Happiness Engineer

    Hi there,

    We’re glad you were able to get this resolved. We’ll go ahead and close this now.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Email template Hook not working when customer orders via PayPal Checkout’ is closed to new replies.