• Hello,
    I want to know if it’s possibile to set a minimum order price for a specific user role.
    I’ve a “wholesale” user role, and i want that kind of user can buy by paying at least €150.
    Any suggestion ??
    Thank you,
    Luca

Viewing 1 replies (of 1 total)
  • Thread Starter shyheim

    (@shyheim)

    my current code is that and it’s good, i only need to limitate that function to a specific user role:

    add_action( ‘woocommerce_checkout_process’, ‘wc_minimum_order_amount’ );
    add_action( ‘woocommerce_before_cart’ , ‘wc_minimum_order_amount’ );

    function wc_minimum_order_amount() {
    // Set this variable to specify a minimum order value
    $minimum = 150;

    if ( WC()->cart->total < $minimum ) {

    if( is_cart() ) {

    wc_print_notice(
    sprintf( ‘You must have an order with a minimum of %s to place your order, your current order total is %s.’ ,
    woocommerce_price( $minimum ),
    woocommerce_price( WC()->cart->total )
    ), ‘error’
    );

    } else {

    wc_add_notice(
    sprintf( ‘You must have an order with a minimum of %s to place your order, your current order total is %s.’ ,
    woocommerce_price( $minimum ),
    woocommerce_price( WC()->cart->total )
    ), ‘error’
    );

    }
    }

    }

Viewing 1 replies (of 1 total)
  • The topic ‘[Woocommerce] ]Minimum order per specif user role’ is closed to new replies.