【问题标题】:Remove shipping info for free shipping method on WooCommerce email notifications在 WooCommerce 电子邮件通知中删除免费送货方式的送货信息
【发布时间】:2018-02-10 19:16:54
【问题描述】:

当客户下订单时,如果已经使用免费送货,我想从订单确认邮件中发送到 remove shipping info 给客户。

有可能实现吗?

【问题讨论】:

    标签: php wordpress woocommerce orders email-notifications


    【解决方案1】:

    这个自定义挂钩函数可以实现这一点(但来自所有电子邮件通知)

    add_filter( 'woocommerce_get_order_item_totals', function( $total_rows, $order, $tax_display ){
    
        // Only for "Free Shipping" method
        if( ! $order->has_shipping_method('free_shipping') || is_account_page() || is_wc_endpoint_url( 'order-received' ) )
            return $total_rows; 
    
        unset($total_rows['shipping']);
    
        return $total_rows;
    }, 11, 3 );
    

    代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件中。

    此代码已经过测试并且可以工作。

    【讨论】:

      猜你喜欢
      • 2019-09-08
      • 1970-01-01
      • 2016-12-20
      • 2020-06-22
      • 2016-11-11
      • 2021-05-29
      • 2019-05-31
      • 2019-08-23
      相关资源
      最近更新 更多