这里描述的问题正是我需要做的,并且解决方案有效:
Woocommerce:更改订单按钮上的文本[已更新]
然而,我们接受一次性“订单”,以捐赠和订阅的形式赞助一名儿童。如果购物车中有订阅,结账按钮会显示“立即注册”。无论购物车中有什么,我都需要它来阅读“立即给予”。
http://www.childhopeonline.org(上述更改尚未生效,目前使用默认的“下订单”,无论购物车中有什么,它都是一致的)
翻译好像不行。
我也尝试过:
function woocommerce_custom_subscription_product_single_add_to_cart_text( $text = '' , $post = '' ) {
global $product;
if ( $product->is_type( 'subscription' ) ) {
$text = get_option( WC_Subscriptions_Admin::$option_prefix . '_add_to_cart_button_text', __( 'Give Now', 'woocommerce-subscriptions' ) );
} else {
$text = $product->add_to_cart_text(); // translated "Read More"
}
return $text;
}
add_filter('woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_subscription_product_single_add_to_cart_text', 2, 10);
Run Code Online (Sandbox Code Playgroud) php wordpress checkout woocommerce woocommerce-subscriptions