//Woocommerce 用自定义按钮/链接替换添加到购物车按钮(作用于列表页)
add_filter( 'woocommerce_loop_add_to_cart_link', 'replacing_add_to_cart_button', 10, 2 );
function replacing_add_to_cart_button( $button, $product ) {
$button_text = __("Inquiry For Pricelist", "woocommerce");
// $button = '<a class="button" href="' . $product->get_permalink() . '" rel="external nofollow" >' . $button_text . '</a>';
$button = '<a class="button" style="width: 100%;" href="#####" rel="external nofollow" >' . $button_text . '</a>';
return $button;
}
//移除添加购物车按钮
remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
//移除产品页面价格
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
//移除商店页面价格
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
add_Action('wp_head','my_head_css');
function my_head_css(){
echo "<style>
.product_meta>span {
display: none!important;
}
.entry-summary .ct-share-box {
display: none!important;
}
</style>
";}
还没有评论呢,快来抢沙发~