Woocommerce结帐如果添加了客户字段,结账时内部服务器错误

时间:2017-06-09 17:23:34

标签: wordpress woocommerce

我正在尝试添加一个服装领域作为woo商业中的税收确实它出现在购物车中如预期和结帐时但是当我继续付款或结帐时它显示Internal Server Error

  

[09-Jun-2017 17:44:07 UTC] PHP致命错误:调用成员函数   数组中的get_id()   /home/xxxxx/xxxx/xxxx.com/test/wp-content/plug INS / woocommerce-PDF的发票/包括/ AB文摘/抽象-INV oice.php   在第615行

我的代码:

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 个答案:

答案 0 :(得分:1)

调用阵列上的成员函数get_id()来自woocommerce-pdf-invoices插件。禁用它将解决此错误