• Resolved jaysonvds

    (@jaysonvds)


    Would it be possible to add options to either
    only show for specific shipping methods, or
    to only show to not logged in users, or
    to not show if user role = XXXX.

    We have different user roles and the different user types have their own shipping methods and we ant to only display this for casual browsers / users that do not meet the certain user role or shipping method. either of these options would work for our scenario, but I’m sure all 3 options would be beneficial to other users at different stages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Marin Matosevic

    (@marinmatosevic)

    Hi,

    yes, it’s possible with filter hooks.

    Here is an example for user role named “some_user_role”
    These users won’t see the progress bar or the label.

    add_filter('fsl_min_amount', function ($amount) {
    
    	$user = wp_get_current_user();
    
    	if (!in_array('some_user_role', (array) $user->roles)) {
    		$amount = null;
    	}
    
    	return $amount;
    });

    another example, logged-in users won’t see progress bar or the label.

    add_filter('fsl_min_amount', function ($amount) {
    
    	if (is_user_logged_in()) {
    		$amount = null;
    	}
    
    	return $amount;
    });

    put only one of these examples in the functions.php file of your child theme.

    A similar approach can be applied for shipping method checks or any other verification.

    Best regards

    Plugin Author Marin Matosevic

    (@marinmatosevic)

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please feel free to start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Do not display for selected user roll or Not logged in users only’ is closed to new replies.