For a recent website project running Woocommerce, I created a custom registration page and a custom password re-set page. Using the built in Woocommerce SSL feature, I was not able to force a secure connection on these additional pages. So I created a function and used a function hook (Below).
Woocommerce has a built in feature that allows you to force SSL on Woocommerce related pages “Force secure checkout”, but if you have additional pages that need to be secured, you will need to use a plugin or create a custom function. If you use an SSL plugin, you will need to leave the Woocommerce SSL setting un-checked, otherwise the SSL plugin and Woocommerce will conflict with one another.
In order to set up the function, at the time of writing this post, I copied functionality out of the Woocommmerce core – woocommerce-functions.php. And I included the additional pages that I need to protect. And I removed any unnecessary code. If you plan to use a similar function, you will need to make sure that the built in Woocommerce SSL setting is disabled to prevent any conflicts.
In the code below, pages 48 & 64 are the pages that have been added when forcing SSL. The function will force SSL on the required pages, and it will break out of SSL on pages that don’t need to be secured. Running the entire site over SSL will slow the site down.