Woocommerce 在结帐页面中使用复选框更改商业税率

Woocommerce 在结帐页面中使用复选框更改商业税率,woocommerce,Woocommerce,我打算使用以下代码排除海外销售中的税收: 这是代码。我从某处抄袭: add_action( 'woocommerce_after_order_notes', 'qd_tax_exempt'); function qd_tax_exempt( $checkout ) { echo '<div id="qd-tax-exempt"><h3>'.__('Tax Exempt').'</H3>'; woocommerce_form

我打算使用以下代码排除海外销售中的税收: 这是代码。我从某处抄袭:

add_action( 'woocommerce_after_order_notes', 'qd_tax_exempt');
function qd_tax_exempt( $checkout ) {
    echo '<div id="qd-tax-exempt"><h3>'.__('Tax Exempt').'</H3>';

    woocommerce_form_field( 'shipping_method_tax_exempt', array(
        'type' => 'checkbox',
        'class' => '',
        'label' => __('My organization is tax exempt.'),
        'Required' => false,
    ), $checkout->get_value( 'shipping_method_tax_exempt' ));

    echo '</div>';
}

add_action( 'woocommerce_checkout_update_order_review', 'taxexempt_checkout_update_order_review');
function taxexempt_checkout_update_order_review( $post_data ) {
    global $woocommerce;

    $woocommerce->customer->set_is_vat_exempt(FALSE);

    parse_str($post_data);

    if ( isset($shipping_method_tax_exempt) && $shipping_method_tax_exempt == '1')
    //here i need change the tax_rate not set the exempt
    $woocommerce->customer->set_is_vat_exempt(true);
}
add_action('woocommerce_在订单注释之后,'qd_免税');
功能qd_免税($checkout){
回显“”。_uu(‘免税’)”;
woocommerce\u form\u字段('shipping\u method\u tax\u免税',数组(
'键入'=>'复选框',
“类”=>“”,
“label'=>\(“我的组织免税”),
“必需”=>false,
),$checkout->get_value('shipping_method_tax_免税');
回声';
}
添加操作('woocommerce\u checkout\u update\u order\u review'、'Taxempt\u checkout\u update\u order\u review');
函数taxempt\u checkout\u update\u order\u review($post\u data){
全球商业;
$woocommerce->customer->set_是免税的(假);
parse_str($post_data);
如果(isset($shipping\u method\u tax\u免税)&&$shipping\u method\u tax\u免税=='1')
//这里我需要更改税率而不是设置免税
$woocommerce->customer->set_是免税的(true);
}
但是,如果选择了其他国家,我希望向客户提供此选项

我想提交免税条款供客户批准。
我想在订单页面上记录此确认

由于我的研究,我的代码没有完全满足我的要求,所以我在等待你的建议