• ResolvedPlugin Author Saiful Islam

    (@codersaiful)


    If you want to disable min max step control for any type user, You have to use three hook of our Min Max Control plugin by CodeAstrology.

    See example Code at Gist or at bellow:

    /**
     * Disable min max for specific condition
     * 
     * @author Saiful Islam <[email protected]>
     */
    add_filter('wcmmq_single_product_min_max_condition','wcmmq_custom_min_max_control');
    add_filter('wcmmq_add_validation_check','wcmmq_custom_validation_bool');
    add_filter('wcmmq_cart_validation_check','wcmmq_custom_validation_bool');
    function wcmmq_custom_min_max_control( $args ){
    	if( wc_current_user_has_role('administrator') || wc_current_user_has_role('shop_manager') ){
    		$args['max_value'] = -1;
    		$args['min_value'] = 1;
    		$args['step'] = 1;
    		if( ! is_cart() ){
    			$args['input_value'] = 1;
    		}
    		return $args;
    	}
    
    	return $args;
    }
    function wcmmq_custom_validation_bool(){
    	if( wc_current_user_has_role('administrator') || wc_current_user_has_role('shop_manager') ){
    		return false;
    	}else{
    		return true;
    	}
    }

    The page I need help with: [log in to see the link]

  • The topic ‘Disable min max step control for specific user’ is closed to new replies.