woocommerce_force_ssl_checkout

woocommerce_force_ssl_checkout

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_force_ssl_checkout') is found 1 times:

  • /includes/class-wc-https.php line 89
    	/**
    	 * Template redirect - if we end up on a page ensure it has the correct http/https url.
    	 */
    	public static function force_https_template_redirect() {
    		if ( ! is_ssl() && ( is_checkout() || is_account_page() || apply_filters( 'woocommerce_force_ssl_checkout', false ) ) ) {
    
    			if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
    				wp_safe_redirect( preg_replace( '|^http://|', 'https://', $_SERVER['REQUEST_URI'] ) );
    				exit;
    			} else {
    				wp_safe_redirect( 'https://' . ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'] ) . $_SERVER['REQUEST_URI'] );