如果订单总数为0,我想更改下订单文本的文本,这与免费订单有所不同。
我试过了
add_filter( 'woocommerce_order_button_text', 'misha_custom_button_text' );
function misha_custom_button_text( $button_text ) {
return 'Submit'; // new text is here
}
我希望我能找到一个解决方案
用此代码替换您的代码。
add_filter('woocommerce_order_button_text', 'misha_custom_button_text', 9999);
function misha_custom_button_text($button_text) {
global $woocommerce;
$total = $woocommerce->cart->total;
if ($total == 0) {
$button_text = "Free Orders";
}
return $button_text;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句