【发布时间】:2020-08-23 01:22:44
【问题描述】:
我尝试在某些类别的产品页面上的 WooCommerce 添加到购物车按钮下方添加一个 div。
我在这里有点不知所措。这段代码没有破坏任何东西,但没有显示文本。
我试过:.woocommerce div.product form.cart::after,但这适用于所有产品。
这是 PHP sn-p:
function add_polarity_info() {
global $product;
if( is_product() && has_term( ['telecaster-pickups', 'strat-pickups', 'bass-pickups', 'p90-pickups', 'humbuckers', 'dynasonic-pickups', 'mini-humbuckers'], 'product_cat' )) {
echo 'If you are pairing with pickups from another manufacturer and are concerned about polarity and phasing, please let us know in the NOTES field on the checkout screen';
}};
add_action( 'woocommerce_after_add_to_cart_button', add_polarity_info() );
有人能指出我的代码的问题吗?
【问题讨论】:
标签: php wordpress woocommerce product hook-woocommerce