Support » Plugin: WooCommerce » Remove Payment method listed twice in customers emails

  • Resolved Alex Toma

    (@alextoma)


    Hi Mike,

    How can remove from customers emails “pay with cash upon delivery” ?

    I try this function but only remove from table.

    <?php // Do not include this if already open!

    
    /**
     * Code goes in theme functions.php.
     */
    add_filter( 'woocommerce_get_order_item_totals', 'custom_woocommerce_get_order_item_totals' );
    
    function custom_woocommerce_get_order_item_totals( $totals ) {
      unset( $totals['payment_method'] );
      return $totals;
    }
    

    Payment method is listed twice in emails, the above code removes only the one from the table, but there still remains this string: ‘Pay with cash upon delivery.’ above that table.

    https://gist.github.com/mikejolley/c4606aa52754b334f0f1bbe7e5b5ca6b

    Thank you !

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

    (@purpleberryservices)

    Can you share the screenshot where you would like to remove payment details?

    Thread Starter Alex Toma

    (@alextoma)

    Hi Mina,

    “Pay with cash upon delivery” i need to remove from emails customers.

    View post on imgur.com

    Thank you!

    • This reply was modified 6 years, 4 months ago by Alex Toma.
    Mina

    (@purpleberryservices)

    Add below line to functions.php file

    remove_action( ‘woocommerce_email_before_order_table’, $order, $sent_to_admin, $plain_text, $email );

    Mina

    (@purpleberryservices)

    Sorry do this:

    Comment out below line from WooCommerce Template: woocommerce/emails/email-order-details.php
    and woocommerce/emails/plain/email-order-details.php

    do_action( ‘woocommerce_email_before_order_table’, $order, $sent_to_admin, $plain_text, $email );

    Anonymous User 14479022

    (@anonymized-14479022)

    Or you could just override that with a customised WooCommerce template. For more details on how to get started with that, have a look at: https://docs.woocommerce.com/document/template-structure/

    Thread Starter Alex Toma

    (@alextoma)

    Hi again Mina,

    I comment out that line of code in both locations but continue to showing in costumers emails order.

    The best solution would be a function i think… Can you provide that please?

    I appreciate the effort to help me,

    Thank you! 🙂

    Mina

    (@purpleberryservices)

    Hi,

    Commenting both line does work on my test site.

    Where did you comment it? I mean it should be in your child themes template as specified in https://docs.woocommerce.com/document/template-structure/

    Thread Starter Alex Toma

    (@alextoma)

    Hi MarilizeK,

    I use child theme and have other customizations for woocommerce but i don’t find a solution for remove payment methods from header email before order table.

    Thread Starter Alex Toma

    (@alextoma)

    Hi Mina,

    I try first modify original woocommerce template files and after on child theme public_html/wp-content/themes/twentysixteen-child/woocommerce/emails/email-order-details.php and public_html/wp-content/themes/twentysixteen-child/plain/email-order-details.php, but not work…

    I comment out on line 23

    do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email );
    

    Hi Alex,
    I didn’t see a reply to your last question and worked on the same thing just now.

    The path for html emails you pointed is correct and should work…
    The path for plain emails should be:
    public_html/wp-content/themes/twentysixteen-child/woocommerce/emails/plain/email-order-details.php

    If you mistyped here and actually did put it in the correct folder it should work fine.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Remove Payment method listed twice in customers emails’ is closed to new replies.