Force HTTPS Secure Protocol On Wholesale Login

If you’ve followed our WooCommerce SSL guide you will know about the benefits of having your site on secure protocol.

But what happens if you only run part of your WooCommerce website on secure protocol?

Wholesale Customers that login via the WooCommerce Wholesale Lead Capture plugin’s login page will also likely need to login via this protocol to ensure they are browsing the website in this secure version of your site.

In this case, it might be best to ensure that anyone that logs in is redirected to the https:// version of your site to avoid issues during checkout.

You can try the following code to force the secure protocol on login redirection:


function wwlcWholesaleLeadLoginRedirect( $redirect_to, $request, $user ) {

    if ( parse_url( $redirect_to, PHP_URL_SCHEME ) == 'http' ) {
        $redirect_to = str_replace( 'http://', 'https://', $redirect_to );
    }
    
    return $redirect_to;

}

add_filter( 'login_redirect' , 'wwlcWholesaleLeadLoginRedirect' , 10 , 3 );

Add this code to your functions.php file in your theme and it will redirect any non-secure login to the secure version of your website and people can browse and checkout happily.

in WooCommerce Wholesale Lead Capture

Solve The Big Three Problems With Wholesaling In WooCommerce

Add wholesale pricing to products   Streamline your ordering   Register & manage wholesale customer

Explore The Plugin Suite  

[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']