Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 删除“;为{国家}估算;Woocommerce结账页面中的税后金额文本_Php_Wordpress_Woocommerce_Checkout_Tax - Fatal编程技术网

Php 删除“;为{国家}估算;Woocommerce结账页面中的税后金额文本

Php 删除“;为{国家}估算;Woocommerce结账页面中的税后金额文本,php,wordpress,woocommerce,checkout,tax,Php,Wordpress,Woocommerce,Checkout,Tax,我在Woocommerce网上商店设定了19%的标准税额。不幸的是,现在在我的结帐页面(见下图)的总金额下面有一个文本“estimated for Germany”(包括20,12€…部分)。我猜它显示了文本,因为计算的税额有很多小数 HTML (包括 20.12 € 估计(德国) 如果使用20%的税额,则情况并非如此 如何删除“德国估算”文本? 我找不到任何筛选器或html类以文本为目标。负责的代码位于wc\u cart\u totals\u order\u total\u html()

我在Woocommerce网上商店设定了19%的标准税额。不幸的是,现在在我的结帐页面(见下图)的总金额下面有一个文本“estimated for Germany”(包括20,12€…部分)。我猜它显示了文本,因为计算的税额有很多小数

HTML


(包括
20.12
€
估计(德国)
如果使用20%的税额,则情况并非如此

如何删除“德国估算”文本?

我找不到任何筛选器或html类以文本为目标。

负责的代码位于
wc\u cart\u totals\u order\u total\u html()函数中

因此,我们可以在
woocommerce\u cart\u totals\u order\u total\u html
filter钩子中使用钩子函数,在这里我们将删除这种恼人的行为(增加了2.6.x及以上版本的兼容性):

add_filter('woocommerce_cart_totals_order_total_html'、'custom_cart_totals_order_total_html',20,1);
函数自定义\购物车\总计\订单\总计\ html($value){
$value=''.WC()->cart->get_total()。';
//如果价格含税,请在此处显示税费。
$includ_tax_display_cart=版本比较(WC_版本,'3.3','
<small class="includes_tax">
(includes 
    <span class="woocommerce-Price-amount amount">20.12
        <span class="woocommerce-Price-currencySymbol">€<span>
    </span> estimated for Germany)
</small>
add_filter( 'woocommerce_cart_totals_order_total_html', 'custom_cart_totals_order_total_html', 20, 1 );
function custom_cart_totals_order_total_html( $value ){
    $value = '<strong>' . WC()->cart->get_total() . '</strong> ';

    // If prices are tax inclusive, show taxes here.
    $incl_tax_display_cart = version_compare( WC_VERSION, '3.3', '<' ) ? WC()->cart->tax_display_cart == 'incl'  : WC()->cart->display_prices_including_tax();
    if ( wc_tax_enabled() && $incl_tax_display_cart ) {
        $tax_string_array = array();
        $cart_tax_totals  = WC()->cart->get_tax_totals();

        if ( get_option( 'woocommerce_tax_total_display' ) == 'itemized' ) {
            foreach ( $cart_tax_totals as $code => $tax ) {
                $tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
            }
        } elseif ( ! empty( $cart_tax_totals ) ) {
            $tax_string_array[] = sprintf( '%s %s', wc_price( WC()->cart->get_taxes_total( true, true ) ), WC()->countries->tax_or_vat() );
        }

        if ( ! empty( $tax_string_array ) ) {
            $taxable_address = WC()->customer->get_taxable_address();
            $estimated_text  = '';
            $value .= '<small class="includes_tax">' . sprintf( __( '(includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) . $estimated_text ) . '</small>';
        }
    }
    return $value;
}