doolo00026 2018-02-03 07:25
浏览 79

在WooCommerce中将通知的结算电子邮件更改为自定义运送电子邮件

I changed checkout page for simpler process - I removed all billing fields and using shipping fields instead. So instead of billing_email I have shipping_email.

When customer makes order he didn't receive email notification because billing_email is not set.

Can you advice how to change customers notifications to be sent to shipping_email instead.

  • 写回答

1条回答 默认 最新

  • dongpiansui8755 2018-02-03 08:06
    关注

    You can try to use the following custom hooked function, where I set the billing email from your custom shipping email. This way the notifications are sent to the correct email.

    You should need to check that '_shipping_email' is the correct metakey for the Shipping email custom checkout field… If not replace it by the right one.

    The code:

    add_action('woocommerce_checkout_update_order_meta', 'set_billing_email_from_shipping_email', 50, 2 );
    function set_billing_email_from_shipping_email( $order_id, $data ) {
        // Get customer shipping email
        $email = get_post_meta( $order_id, '_shipping_email', true );
        // Set billing email from shipping email
        update_post_meta( $order_id, '_billing_email', $email );
    }
    

    Code goes in function.php file of your active child theme (or active theme).

    Tested and works.

    评论

报告相同问题?

悬赏问题

  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)