【发布时间】:2019-06-21 16:05:26
【问题描述】:
我在 WooCommerce 中遇到问题,当货物从一定金额开始为 0.00 欧元时。问题是购物车页面没有显示为 0.00 欧元或免费。
这可以通过在 php 函数文件中输入此代码来解决。我在this post看到了。
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 欧元,还有另一个选项。 I discovered it in the following article.
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 );
问题是,在客户通过电子邮件收到的有关其购买的通知和发送部分的发票中,他没有输入任何内容。尽我所能调查,我没有发现任何东西。
我已经搜索过,但没有找到任何东西。你能帮我解决这个问题吗?
谢谢
【问题讨论】:
标签: php wordpress woocommerce orders shipping-method