我想在woo商业中添加一个服装领域作为税收确实它正如预期的那样出现在购物车中并且在结账时也是如此,但是当我继续付款或结账时它说 Internal Server Error
[09-Jun-2017 17:44:07 UTC] PHP致命错误:在/home/xxxxx/xxxx/xxxx.com/test/wp-content/plugins/woocommerce-中调用阵列上的成员函数get_id()第615行的pdf-invoices / includes / abstracts / abstract-invoice.php
我的代码:
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
global $woocommerce;
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
$percentage = 0.03;
$taxes = array_sum($woocommerce->cart->taxes);
$surcharge = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total + $taxes ) * $percentage;
// Make sure that you return false here. We can't double tax people!
$woocommerce->cart->add_fee( 'Processing Fee', $surcharge, false, '' );
}
1 回答
在阵列上调用成员函数
get_id()
来自woocommerce-pdf-invoices插件 . 禁用它将解决此错误