【发布时间】:2018-03-04 19:10:22
【问题描述】:
这是我的情况:
如果小计
因此,如果小计符合此条件,那么我想收取运费,该费用也应显示在电子邮件发票中。
目前这是我的代码:
add_action( 'woocommerce_cart_calculate_fees','my_delivery_fee' );
function my_delivery_fee() {
global $woocommerce;
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
$subtotal = $woocommerce->cart->subtotal;
if(subtotal <= certain amount && subtotal <= certain amount){
$woocommerce->cart->add_fee( 'Delivery Fees', 5, true, 'standard' );
}
}
但它没有显示任何东西。
我做错了什么?
【问题讨论】:
标签: php wordpress woocommerce cart shipping