【发布时间】:2019-12-04 13:04:57
【问题描述】:
我将以下代码添加到“My Custom Functions PHP Inserter”插件中,以在我的 woocommerce 商店中显示自定义价格后缀。
add_filter( 'woocommerce_get_price_html', 'custom_price_suffix', 100, 2 );
function custom_price_suffix( $price, $product ){
$price = $price . ' inkl. MwSt. und <a href="http://www.link.to/shippinginfo">zzgl. Versandkosten</a>';
return apply_filters( 'woocommerce_get_price', $price );
}
它有效,但它还在产品类别页面和商店页面上显示价格。我怎样才能避免这种情况?
我尝试了这个 css 代码但不起作用:
.woocommerce-price-suffix {
display: none;
}
.single-product .product-price-wrap .woocommerce-price-suffix {
display: block !important;
}
以下解决方案可能有效,但我不想在我的主题中覆盖 php 文件:hide Woocommerce price suffix on category page
我也想改变“inkl. MwSt. und zzgl. Versandkosten”的字体大小,但我不知道如何在 php.ini 中执行此操作。尝试了这个 css 但什么也没做:
.custom_price_suffix {
font-size: small;
}
【问题讨论】:
-
显示实时页面。
标签: php css woocommerce