enabled = $settings['enabled']; add_action( 'admin_init', array( $this, 'check_settings' ) ); } /** * Checks the settings. */ public function check_settings() { if ( ! empty( $_POST ) ) { add_action( 'woocommerce_settings_saved', array( $this, 'check_terms' ) ); } else { add_action( 'admin_notices', array( $this, 'check_terms' ) ); add_action( 'admin_notices', array( $this, 'check_https' ) ); } } /** * Check if terms page is set. */ public function check_terms() { if ( 'yes' !== $this->enabled ) { return; } // Terms page. if ( ! wc_get_page_id( 'terms' ) || wc_get_page_id( 'terms' ) < 0 ) { echo '
' . esc_html( __( 'You need to specify a terms page in WooCommerce Settings to be able to use Klarna Checkout.', 'klarna-checkout-for-woocommerce' ) ) . '
'; echo '' . esc_html( __( 'You need to enable and configure https to be able to use Klarna Checkout.', 'klarna-checkout-for-woocommerce' ) ) . '
'; echo '