将增值税添加到woocommerce费用中

时间:2019-06-24 11:31:54

标签: php woocommerce tax fee

我创建了此代码,以添加货到付款和Paypal佣金的费用。 该代码有效,但我也希望您在[增值税]字段中加税。我该如何加税?

if ( ( is_admin() && ! defined( 'DOING_AJAX' ) ) || ! is_checkout() )
    return;

$chosen_gateway = $woocommerce->session->chosen_payment_method;
$feepaypal = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total + $fees_cost + 0.35 ) * 0.039;

$feecod = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total + $fees_cost ) * 0.01;
if ( $chosen_gateway == 'paypal' ) {
    $woocommerce->cart->add_fee( 'Spese di gestione', $feepaypal, false, '' );
}

if ($feecod < 2.58) { 
    $feecod=2.58;
}

if ( $chosen_gateway == 'cod' ) { 
   $woocommerce->cart->add_fee( 'Commissione Contrassegno', $feecod, false, '' );
}

0 个答案:

没有答案