Automattic\WooCommerce\Internal\StockNotifications\Frontend
MyAccountEndpoint::redirect_with_error
Queue an error notice and redirect back to the stock notifications endpoint.
Method of the class: MyAccountEndpoint{}
No Hooks.
Returns
never.
Usage
// private - for code of main (parent) class only $result = $this->redirect_with_error( $message, $page );
- $message(string) (required)
- The error to show the customer.
- $page(int)
- 1-indexed page to return the customer to.
Default:1
MyAccountEndpoint::redirect_with_error() MyAccountEndpoint::redirect with error code WC 11.3.0
private function redirect_with_error( string $message, int $page = 1 ) {
\wc_add_notice( esc_html( $message ), 'error' );
wp_safe_redirect( self::get_endpoint_url( $page ) );
exit;
}