【发布时间】:2020-06-24 16:08:31
【问题描述】:
我想在我的 Woocommerce 商店的目录页面中显示每个产品下的产品价格包括和不含税。
它已经在工作了,但是对于我只有一个变体的可变产品,它没有显示任何东西。它也适用于单一产品。
我也确实收到了通知:
注意:WC_Product::get_price_includes_tax 是版本 3.0 veraltet! Benutze stattdessen wc_get_price_including_tax.
注意:WC_Product::get_price_exclude_tax ist seit 3.0 veraltet! Benutze stattdessen wc_get_price_ exclude_tax。
但如果我这样做了,它就根本不起作用了。
add_action( 'woocommerce_after_shop_loop_item_title', 'preise_notice', 10 );
function preise_notice() {
global $product;
if ( $price_html_incl_tax = $product->get_price_including_tax() )
if ( $price_html_excl_tax = $product->get_price_excluding_tax() ) {
echo '<div class="product-prices-excl-vat"><a>ab ' . wc_price($price_html_excl_tax) . ' netto</a></div>';
echo '<div class="product-prices-incl-vat"><a>(' . wc_price($price_html_incl_tax) . ' inkl. 19% MwSt.)</a></div>';
}
}
【问题讨论】:
标签: woocommerce