根据WooCommerce中的用户角色和购物车总数,结帐时更改订单按钮文本

问题描述 投票:-1回答:1

如果用户角色是客户,我们需要签入以下功能。

如果订单总数为0,下面的功能会更改下订单按钮的文本,我们需要它检查用户角色是否也是客户并且总数为0。

我们到目前为止使用的代码

function mishaa_custom_button_text($button_text) {
    global $woocommerce;
    $total = $woocommerce->cart->total;
    if ($total == 0 ) {
        $button_text = "Submit Registration";
    }
    return $button_text;
} 
add_filter( 'woocommerce_order_button_text', 'mishaa_custom_button_text' );
php wordpress woocommerce checkout hook-woocommerce
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.