当客户下订单时,如果已使用免费送货,我希望从发给客户的订单确认邮件中删除送货信息
。
有可能实现这个目标吗?
最佳答案
使用这个自定义 Hook 函数可以实现这一点(但来自所有电子邮件通知):
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 文件中或任何插件文件中。
此代码经过测试并且可以工作。
关于php - 在 WooCommerce 电子邮件通知中删除免费送货方式的送货信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46005060/