这是我的代码:
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 +
function woo_custom_cart_button_text( $text ) {
if( has_term( 'liners', 'product_cat' ) ){
$text = __( ' ', 'your-plugin' );
echo do_shortcode('<a href="#" class="popmake-923">Request ? Quote</a>');
}
return $text;
}
Run Code Online (Sandbox Code Playgroud)
我需要制作功能来替换一个特定产品类别的“添加到购物车”按钮 URL 和文本。
此按钮将触发带有联系表单的灯箱,此按钮的文本将是:Request a Quote。
我怎样才能让它按预期工作?
以下是它在此链接上的实际工作方式。