我在WooCommerce上建立了网上商店。当客户填写帐单地址时,我已经添加了标准税率,并且选择的国家/地区税将适用于正常工作的结帐页面。我想在购物车页面上显示产品的实际价格,而无需将税率乘以我的产品价格>
这是一个结帐页面,显示了选择一个国家/地区的税款
这是购物车页面,显示税额计算值和不含税值的总计显示
我已经在我的function.php文件中添加了此功能,但是没有成功
function wc_remove_cart_tax_totals( $tax_totals, $instance ) {
if( is_cart() ) {
$tax_totals = array();
}
return $tax_totals;
}
add_filter( 'woocommerce_cart_tax_totals', 'wc_remove_cart_tax_totals', 10, 2 );
// Show the cart total excluding tax.
function wc_exclude_tax_cart_total( $total, $instance ) {
// If it is the cart subtract the tax
if( is_cart() ) {
$total = round( WC()->cart->cart_contents_total + WC()->cart->shipping_total + WC()->cart->fee_total, WC()->cart->dp );
}
return $total;
}
add_filter( 'woocommerce_calculated_total', 'wc_exclude_tax_cart_total', 10, 2 );
add_filter( 'woocommerce_subscriptions_calculated_total', 'wc_exclude_tax_cart_total', 10, 2 );