enabled = $afterpay_invoice_settings['enabled']; $this->username = $afterpay_invoice_settings['username']; $this->username_se = $afterpay_invoice_settings['username_se']; add_action( 'admin_init', array( $this, 'check_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' ) ); } } /** * Check if terms page is set */ public function check_terms() { if( 'yes' != $this->enabled ) { return; } // Terms page if( $this->username && !$this->username_se ) { echo '
'; echo '

' . __( 'We have updated the settings for AfterPay. You need to enter your AfterPay merchant credentials again and resave the settings top be able to take payments via AfterPay.', 'woocommerce-gateway-afterpay' ) . '

'; echo '
'; } } } $wc_afterpay_admin_notices = new WC_AfterPay_Admin_Notices;