在 Dokan 插件的供应商新订单电子邮件中隐藏自定义 Woocommerce 附加费

时间:2021-06-24 15:00:51

标签: wordpress email woocommerce vendor dokan

首先,我对 Wordpress 自定义还很陌生,我仍在学习。

我已经添加了一个自定义代码,以增加运送到选定位置的额外费用,因为我参考了这篇博文 https://www.businessbloomer.com/woocommerce-add-shipping-fee-non-continental-states/

//add additional fee for East Malaysia
add_action( 'woocommerce_cart_calculate_fees', 'bbloomer_add_cart_fee' );
   
  function bbloomer_add_cart_fee() {
  $noncontinental = array('SBH','SWK','LBN');
  if( in_array( WC()->customer->shipping_state, $noncontinental ) ) {
   $surcharge = 15.00;
   WC()->cart->add_fee( __('Additional Charges For (Sabah,Sarawak & Labuan)', 'woocommerce'), $surcharge );
  }
  }

我想隐藏供应商电子邮件布局中的“附加费用(沙巴、砂拉越和纳闽)”行作为附件? https://ibb.co/rFnBKWQ

我尝试编辑模板布局,但我不确定应该编辑哪个挂钩或在哪里。我尝试编辑代码如下。

//remove shipping fee from vendor email
add_filter('wcmp_vendor_get_order_item_totals', 'new_order_mail_display_shipping_method', 10, 3);
function new_order_mail_display_shipping_method( $order_item_totals, $order, $vendor ) {
unset($order_item_totals['shipping_subtotal']);
unset($order_item_totals['tax_subtotal']);  
unset($order_item_totals['shipping_state']);        
return $order_item_totals;  
}

我该如何解决这个问题?提前致谢。

0 个答案:

没有答案