Php 将“添加到购物车”文本更改为“添加到购物车”;套用;仅在WooCommerce单一产品页面上
我正在使用下面的代码将“添加到购物车”按钮替换为“商店中的产品”、“相关产品”和“存档”页面的链接按钮Php 将“添加到购物车”文本更改为“添加到购物车”;套用;仅在WooCommerce单一产品页面上,php,wordpress,button,woocommerce,product,Php,Wordpress,Button,Woocommerce,Product,我正在使用下面的代码将“添加到购物车”按钮替换为“商店中的产品”、“相关产品”和“存档”页面的链接按钮 add_action( 'woocommerce_after_shop_loop_item', 'shop_view_product_button', 10); function shop_view_product_button() { global $product; $link = $product->get_permalink(); echo '&l
add_action( 'woocommerce_after_shop_loop_item', 'shop_view_product_button', 10);
function shop_view_product_button() {
global $product;
$link = $product->get_permalink();
echo '<a href="' . $link . '" class="button addtocartbutton">View Product</a>';
}
add_action('woocommerce_在_shop_loop_item之后,'shop_view_product_button',10);
功能车间\查看\产品\按钮(){
全球$产品;
$link=$product->get_permalink();
回声';
}
但我需要将单个产品页面上的“添加到购物车”按钮文本更改为“应用”
有什么帮助吗?请使用以下命令:
add_filter( 'woocommerce_product_single_add_to_cart_text', 'product_single_add_to_cart_custom_text', 20, 1 );
function product_single_add_to_cart_custom_text( $text ) {
$text = __( 'Apply', 'woocommerce' );
return $text;
}
很好,很好用谢谢:)