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.

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support