我在 WooCommerce 中遇到问题,当货件从一定数量开始为 0.00 欧元时。问题是购物车页面没有出现 0.00 欧元或免费。
这可以通过在 php 函数文件中输入此代码来解决。我在这篇文章中看到了。
add_filter( 'woocommerce_cart_shipping_method_full_label', 'add_free_shipping_label', 10, 2 );
function add_free_shipping_label( $label, $method ) {
if ( $method->cost == 0 ) {
$label = 'Free shipping'; //not quite elegant hard coded string
}
return $label;
}
如果您希望显示 0.00 欧元,还有另一个选项。我在下面的文章中发现了它。
function my_custom_show_price_with_free_shipping( $label, $method ) {
$label = $method->get_label();
if ( WC()->cart->tax_display_cart == 'excl' ) {
$label .= ': ' . wc_price( $method->cost );
if ( $method->get_shipping_tax() > 0 && wc_prices_include_tax() ) {
$label .= ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
}
} else {
$label .= ': ' . wc_price( $method->cost + $method->get_shipping_tax() );
if ( $method->get_shipping_tax() > 0 && ! wc_prices_include_tax() ) {
$label .= ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>';
}
}
return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label', 'my_custom_show_price_with_free_shipping', 10, 2 );
问题是,在客户通过电子邮件收到的关于他的购买和发送部分的发票的通知中,他没有放任何东西。据我调查,我没有发现任何东西。
我已经搜索过,但我没有找到任何东西。你能帮我解决这个问题吗?
谢谢