Automattic\WooCommerce\Internal\StockNotifications\Admin
ListTable::process_delete_action
Process delete action.
Method of the class: ListTable{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ListTable = new ListTable(); $ListTable->process_delete_action(): void;
ListTable::process_delete_action() ListTable::process delete action code WC 10.3.6
public function process_delete_action(): void {
$action = isset( $_GET['notification_action'] ) ? wc_clean( wp_unslash( $_GET['notification_action'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( 'delete' !== $action ) {
return;
}
$notification_id = isset( $_GET['notification_id'] ) ? absint( $_GET['notification_id'] ) : 0;
if ( ! $notification_id ) {
return;
}
check_admin_referer( 'delete_customer_stock_notification' );
try {
$notification = Factory::get_notification( $notification_id );
$this->data_store->delete( $notification );
$notice_message = __( 'Notification deleted.', 'woocommerce' );
NotificationsPage::add_notice( $notice_message, 'success' );
} catch ( \Exception $e ) {
$notice_message = __( 'Notification not found.', 'woocommerce' );
NotificationsPage::add_notice( $notice_message, 'error' );
}
wp_safe_redirect( admin_url( NotificationsPage::PAGE_URL ) );
exit();
}