【发布时间】:2018-01-02 10:12:48
【问题描述】:
这里描述的问题正是我需要做的,并且解决方案有效:
Woocommerce: Change text on order button [Updated]
但是,我们接受以捐赠和订阅形式赞助儿童的一次性“订单”。如果购物车中有订阅,结帐按钮会显示“立即注册”。无论购物车里有什么,我都需要它来阅读“立即给予”。
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);
【问题讨论】:
标签: php wordpress woocommerce checkout woocommerce-subscriptions