Delete_Wishlist::handle_request( $args )

Summary

Delete requested wishlist


Parameters

$args

(Required)


Source

File: src/BigCommerce/Accounts/Wishlists/Actions/Delete_Wishlist.php

	public function handle_request( $args ) {
		$redirect = get_the_permalink( get_option( Wishlist_Page::NAME, 0 ) );
		try {
			$submission = $this->sanitize_request( $args, $_POST );
			$wishlist   = $this->get_customer_wishlist( get_current_user_id(), $submission['id'] );
			$this->wishlists->deleteWishlist( $wishlist->list_id() );

			do_action( 'bigcommerce/form/success', __( 'Wish List deleted', 'bigcommerce' ), $submission, $redirect, [] );
		} catch ( \Exception $e ) {
			do_action( 'bigcommerce/form/error', new \WP_Error( $e->getCode(), $e->getMessage() ), $_POST, $redirect, [] );
		}
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.