Is it possible to disable the place order button by User ID in WooCommerce?
add_filter( 'woocommerce_order_button_html', 'replace_order_button_html', 10, 2 );
function replace_order_button_html( $order_button ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
$wpuser_object = wp_get_current_user_id();
$allowed_users = array( 1, 2);
if ( array_intersect($allowed_users, $wpuser_object->id) ){
$order_button_text = __( "Place Order", "woocommerce" );
$style = ' style="color:#fff;cursor:not-allowed;background-color:#999;"';
return '<a class="button alt"'.$style.' name="woocommerce_checkout_place_order" id="place_order" >' . esc_html( $order_button_text ) . '</a>';
}
}